Unverified Commit 7d83a166 authored by Rafał Augustyniak's avatar Rafał Augustyniak Committed by GitHub
Browse files

experimentation: remove unused TestConfig proto (#1251)

parent 480b4352
Showing with 213 additions and 1890 deletions
+213 -1890
......@@ -6,57 +6,6 @@ import "validate/validate.proto";
option go_package = "github.com/lyft/clutch/backend/api/chaos/serverexperimentation/v1;serverexperimentationv1";
message TestConfig {
// The pair of clusters specifying the origin and the destination of
// the traffic that faults should be applied to.
ClusterPairTarget cluster_pair = 1 [ (validate.rules).message.required = true ];
oneof fault {
option (validate.required) = true;
AbortFaultConfig abort = 2;
LatencyFaultConfig latency = 3;
}
}
// Targets requests from downstream_cluster -> upstream_cluster.
message ClusterPairTarget {
// The name of the downstream cluster.
string downstream_cluster = 1 [ (validate.rules).string = {min_bytes : 1} ];
// The name of the upstream cluster.
string upstream_cluster = 2 [ (validate.rules).string = {min_bytes : 1} ];
// The fault injection cluster that controls whether faults are
// injected by downstream or upstream cluster.
FaultInjectionCluster fault_injection_cluster = 3 [ (validate.rules).enum.defined_only = true ];
}
message AbortFaultConfig {
// The percentage of requests that will be slowed down.
float percent = 1 [ (validate.rules).float = {gt : 0.0, lte : 100.0} ];
// The abort HTTP status that will be returned.
int32 http_status = 2 [ (validate.rules).int32 = {gt : 99, lt : 600} ];
}
message LatencyFaultConfig {
// The percentage of requests that will be slowed down.
float percent = 1 [ (validate.rules).float = {gt : 0.0, lte : 100.0} ];
// The latency duration in milliseconds.
int32 duration_ms = 2 [ (validate.rules).int32.gt = 0 ];
}
enum FaultInjectionCluster {
// Fault injection cluster is unspecified. Faults are not injected.
FAULTINJECTIONCLUSTER_UNSPECIFIED = 0;
// Faults are injected to egress traffic by a downstream service(s).
FAULTINJECTIONCLUSTER_DOWNSTREAM = 1;
// Faults are injected to ingesss traffic by an upstream service(s).
FAULTINJECTIONCLUSTER_UPSTREAM = 2;
}
// The configuration of an HTTP fault.
message HTTPFaultConfig {
// The targeting of the fault describing what requests are being considered for faults.
......
......@@ -36,369 +36,6 @@ var (
// define the regex for a UUID once up-front
var _serverexperimentation_uuidPattern = regexp.MustCompile("^[0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{12}$")
// Validate checks the field values on TestConfig with the rules defined in the
// proto definition for this message. If any rules are violated, an error is returned.
func (m *TestConfig) Validate() error {
if m == nil {
return nil
}
if m.GetClusterPair() == nil {
return TestConfigValidationError{
field: "ClusterPair",
reason: "value is required",
}
}
if v, ok := interface{}(m.GetClusterPair()).(interface{ Validate() error }); ok {
if err := v.Validate(); err != nil {
return TestConfigValidationError{
field: "ClusterPair",
reason: "embedded message failed validation",
cause: err,
}
}
}
switch m.Fault.(type) {
case *TestConfig_Abort:
if v, ok := interface{}(m.GetAbort()).(interface{ Validate() error }); ok {
if err := v.Validate(); err != nil {
return TestConfigValidationError{
field: "Abort",
reason: "embedded message failed validation",
cause: err,
}
}
}
case *TestConfig_Latency:
if v, ok := interface{}(m.GetLatency()).(interface{ Validate() error }); ok {
if err := v.Validate(); err != nil {
return TestConfigValidationError{
field: "Latency",
reason: "embedded message failed validation",
cause: err,
}
}
}
default:
return TestConfigValidationError{
field: "Fault",
reason: "value is required",
}
}
return nil
}
// TestConfigValidationError is the validation error returned by
// TestConfig.Validate if the designated constraints aren't met.
type TestConfigValidationError struct {
field string
reason string
cause error
key bool
}
// Field function returns field value.
func (e TestConfigValidationError) Field() string { return e.field }
// Reason function returns reason value.
func (e TestConfigValidationError) Reason() string { return e.reason }
// Cause function returns cause value.
func (e TestConfigValidationError) Cause() error { return e.cause }
// Key function returns key value.
func (e TestConfigValidationError) Key() bool { return e.key }
// ErrorName returns error name.
func (e TestConfigValidationError) ErrorName() string { return "TestConfigValidationError" }
// Error satisfies the builtin error interface
func (e TestConfigValidationError) Error() string {
cause := ""
if e.cause != nil {
cause = fmt.Sprintf(" | caused by: %v", e.cause)
}
key := ""
if e.key {
key = "key for "
}
return fmt.Sprintf(
"invalid %sTestConfig.%s: %s%s",
key,
e.field,
e.reason,
cause)
}
var _ error = TestConfigValidationError{}
var _ interface {
Field() string
Reason() string
Key() bool
Cause() error
ErrorName() string
} = TestConfigValidationError{}
// Validate checks the field values on ClusterPairTarget with the rules defined
// in the proto definition for this message. If any rules are violated, an
// error is returned.
func (m *ClusterPairTarget) Validate() error {
if m == nil {
return nil
}
if len(m.GetDownstreamCluster()) < 1 {
return ClusterPairTargetValidationError{
field: "DownstreamCluster",
reason: "value length must be at least 1 bytes",
}
}
if len(m.GetUpstreamCluster()) < 1 {
return ClusterPairTargetValidationError{
field: "UpstreamCluster",
reason: "value length must be at least 1 bytes",
}
}
if _, ok := FaultInjectionCluster_name[int32(m.GetFaultInjectionCluster())]; !ok {
return ClusterPairTargetValidationError{
field: "FaultInjectionCluster",
reason: "value must be one of the defined enum values",
}
}
return nil
}
// ClusterPairTargetValidationError is the validation error returned by
// ClusterPairTarget.Validate if the designated constraints aren't met.
type ClusterPairTargetValidationError struct {
field string
reason string
cause error
key bool
}
// Field function returns field value.
func (e ClusterPairTargetValidationError) Field() string { return e.field }
// Reason function returns reason value.
func (e ClusterPairTargetValidationError) Reason() string { return e.reason }
// Cause function returns cause value.
func (e ClusterPairTargetValidationError) Cause() error { return e.cause }
// Key function returns key value.
func (e ClusterPairTargetValidationError) Key() bool { return e.key }
// ErrorName returns error name.
func (e ClusterPairTargetValidationError) ErrorName() string {
return "ClusterPairTargetValidationError"
}
// Error satisfies the builtin error interface
func (e ClusterPairTargetValidationError) Error() string {
cause := ""
if e.cause != nil {
cause = fmt.Sprintf(" | caused by: %v", e.cause)
}
key := ""
if e.key {
key = "key for "
}
return fmt.Sprintf(
"invalid %sClusterPairTarget.%s: %s%s",
key,
e.field,
e.reason,
cause)
}
var _ error = ClusterPairTargetValidationError{}
var _ interface {
Field() string
Reason() string
Key() bool
Cause() error
ErrorName() string
} = ClusterPairTargetValidationError{}
// Validate checks the field values on AbortFaultConfig with the rules defined
// in the proto definition for this message. If any rules are violated, an
// error is returned.
func (m *AbortFaultConfig) Validate() error {
if m == nil {
return nil
}
if val := m.GetPercent(); val <= 0 || val > 100 {
return AbortFaultConfigValidationError{
field: "Percent",
reason: "value must be inside range (0, 100]",
}
}
if val := m.GetHttpStatus(); val <= 99 || val >= 600 {
return AbortFaultConfigValidationError{
field: "HttpStatus",
reason: "value must be inside range (99, 600)",
}
}
return nil
}
// AbortFaultConfigValidationError is the validation error returned by
// AbortFaultConfig.Validate if the designated constraints aren't met.
type AbortFaultConfigValidationError struct {
field string
reason string
cause error
key bool
}
// Field function returns field value.
func (e AbortFaultConfigValidationError) Field() string { return e.field }
// Reason function returns reason value.
func (e AbortFaultConfigValidationError) Reason() string { return e.reason }
// Cause function returns cause value.
func (e AbortFaultConfigValidationError) Cause() error { return e.cause }
// Key function returns key value.
func (e AbortFaultConfigValidationError) Key() bool { return e.key }
// ErrorName returns error name.
func (e AbortFaultConfigValidationError) ErrorName() string { return "AbortFaultConfigValidationError" }
// Error satisfies the builtin error interface
func (e AbortFaultConfigValidationError) Error() string {
cause := ""
if e.cause != nil {
cause = fmt.Sprintf(" | caused by: %v", e.cause)
}
key := ""
if e.key {
key = "key for "
}
return fmt.Sprintf(
"invalid %sAbortFaultConfig.%s: %s%s",
key,
e.field,
e.reason,
cause)
}
var _ error = AbortFaultConfigValidationError{}
var _ interface {
Field() string
Reason() string
Key() bool
Cause() error
ErrorName() string
} = AbortFaultConfigValidationError{}
// Validate checks the field values on LatencyFaultConfig with the rules
// defined in the proto definition for this message. If any rules are
// violated, an error is returned.
func (m *LatencyFaultConfig) Validate() error {
if m == nil {
return nil
}
if val := m.GetPercent(); val <= 0 || val > 100 {
return LatencyFaultConfigValidationError{
field: "Percent",
reason: "value must be inside range (0, 100]",
}
}
if m.GetDurationMs() <= 0 {
return LatencyFaultConfigValidationError{
field: "DurationMs",
reason: "value must be greater than 0",
}
}
return nil
}
// LatencyFaultConfigValidationError is the validation error returned by
// LatencyFaultConfig.Validate if the designated constraints aren't met.
type LatencyFaultConfigValidationError struct {
field string
reason string
cause error
key bool
}
// Field function returns field value.
func (e LatencyFaultConfigValidationError) Field() string { return e.field }
// Reason function returns reason value.
func (e LatencyFaultConfigValidationError) Reason() string { return e.reason }
// Cause function returns cause value.
func (e LatencyFaultConfigValidationError) Cause() error { return e.cause }
// Key function returns key value.
func (e LatencyFaultConfigValidationError) Key() bool { return e.key }
// ErrorName returns error name.
func (e LatencyFaultConfigValidationError) ErrorName() string {
return "LatencyFaultConfigValidationError"
}
// Error satisfies the builtin error interface
func (e LatencyFaultConfigValidationError) Error() string {
cause := ""
if e.cause != nil {
cause = fmt.Sprintf(" | caused by: %v", e.cause)
}
key := ""
if e.key {
key = "key for "
}
return fmt.Sprintf(
"invalid %sLatencyFaultConfig.%s: %s%s",
key,
e.field,
e.reason,
cause)
}
var _ error = LatencyFaultConfigValidationError{}
var _ interface {
Field() string
Reason() string
Key() bool
Cause() error
ErrorName() string
} = LatencyFaultConfigValidationError{}
// Validate checks the field values on HTTPFaultConfig with the rules defined
// in the proto definition for this message. If any rules are violated, an
// error is returned.
......
......@@ -4612,244 +4612,6 @@ export namespace clutch {
/** Namespace v1. */
namespace v1 {
 
/** Properties of a TestConfig. */
interface ITestConfig {
/** TestConfig clusterPair */
clusterPair?: (clutch.chaos.serverexperimentation.v1.IClusterPairTarget|null);
/** TestConfig abort */
abort?: (clutch.chaos.serverexperimentation.v1.IAbortFaultConfig|null);
/** TestConfig latency */
latency?: (clutch.chaos.serverexperimentation.v1.ILatencyFaultConfig|null);
}
/** Represents a TestConfig. */
class TestConfig implements ITestConfig {
/**
* Constructs a new TestConfig.
* @param [properties] Properties to set
*/
constructor(properties?: clutch.chaos.serverexperimentation.v1.ITestConfig);
/** TestConfig clusterPair. */
public clusterPair?: (clutch.chaos.serverexperimentation.v1.IClusterPairTarget|null);
/** TestConfig abort. */
public abort?: (clutch.chaos.serverexperimentation.v1.IAbortFaultConfig|null);
/** TestConfig latency. */
public latency?: (clutch.chaos.serverexperimentation.v1.ILatencyFaultConfig|null);
/** TestConfig fault. */
public fault?: ("abort"|"latency");
/**
* Verifies a TestConfig message.
* @param message Plain object to verify
* @returns `null` if valid, otherwise the reason why it is not
*/
public static verify(message: { [k: string]: any }): (string|null);
/**
* Creates a TestConfig message from a plain object. Also converts values to their respective internal types.
* @param object Plain object
* @returns TestConfig
*/
public static fromObject(object: { [k: string]: any }): clutch.chaos.serverexperimentation.v1.TestConfig;
/**
* Creates a plain object from a TestConfig message. Also converts values to other types if specified.
* @param message TestConfig
* @param [options] Conversion options
* @returns Plain object
*/
public static toObject(message: clutch.chaos.serverexperimentation.v1.TestConfig, options?: $protobuf.IConversionOptions): { [k: string]: any };
/**
* Converts this TestConfig to JSON.
* @returns JSON object
*/
public toJSON(): { [k: string]: any };
}
/** Properties of a ClusterPairTarget. */
interface IClusterPairTarget {
/** ClusterPairTarget downstreamCluster */
downstreamCluster?: (string|null);
/** ClusterPairTarget upstreamCluster */
upstreamCluster?: (string|null);
/** ClusterPairTarget faultInjectionCluster */
faultInjectionCluster?: (clutch.chaos.serverexperimentation.v1.FaultInjectionCluster|null);
}
/** Represents a ClusterPairTarget. */
class ClusterPairTarget implements IClusterPairTarget {
/**
* Constructs a new ClusterPairTarget.
* @param [properties] Properties to set
*/
constructor(properties?: clutch.chaos.serverexperimentation.v1.IClusterPairTarget);
/** ClusterPairTarget downstreamCluster. */
public downstreamCluster: string;
/** ClusterPairTarget upstreamCluster. */
public upstreamCluster: string;
/** ClusterPairTarget faultInjectionCluster. */
public faultInjectionCluster: clutch.chaos.serverexperimentation.v1.FaultInjectionCluster;
/**
* Verifies a ClusterPairTarget message.
* @param message Plain object to verify
* @returns `null` if valid, otherwise the reason why it is not
*/
public static verify(message: { [k: string]: any }): (string|null);
/**
* Creates a ClusterPairTarget message from a plain object. Also converts values to their respective internal types.
* @param object Plain object
* @returns ClusterPairTarget
*/
public static fromObject(object: { [k: string]: any }): clutch.chaos.serverexperimentation.v1.ClusterPairTarget;
/**
* Creates a plain object from a ClusterPairTarget message. Also converts values to other types if specified.
* @param message ClusterPairTarget
* @param [options] Conversion options
* @returns Plain object
*/
public static toObject(message: clutch.chaos.serverexperimentation.v1.ClusterPairTarget, options?: $protobuf.IConversionOptions): { [k: string]: any };
/**
* Converts this ClusterPairTarget to JSON.
* @returns JSON object
*/
public toJSON(): { [k: string]: any };
}
/** Properties of an AbortFaultConfig. */
interface IAbortFaultConfig {
/** AbortFaultConfig percent */
percent?: (number|null);
/** AbortFaultConfig httpStatus */
httpStatus?: (number|null);
}
/** Represents an AbortFaultConfig. */
class AbortFaultConfig implements IAbortFaultConfig {
/**
* Constructs a new AbortFaultConfig.
* @param [properties] Properties to set
*/
constructor(properties?: clutch.chaos.serverexperimentation.v1.IAbortFaultConfig);
/** AbortFaultConfig percent. */
public percent: number;
/** AbortFaultConfig httpStatus. */
public httpStatus: number;
/**
* Verifies an AbortFaultConfig message.
* @param message Plain object to verify
* @returns `null` if valid, otherwise the reason why it is not
*/
public static verify(message: { [k: string]: any }): (string|null);
/**
* Creates an AbortFaultConfig message from a plain object. Also converts values to their respective internal types.
* @param object Plain object
* @returns AbortFaultConfig
*/
public static fromObject(object: { [k: string]: any }): clutch.chaos.serverexperimentation.v1.AbortFaultConfig;
/**
* Creates a plain object from an AbortFaultConfig message. Also converts values to other types if specified.
* @param message AbortFaultConfig
* @param [options] Conversion options
* @returns Plain object
*/
public static toObject(message: clutch.chaos.serverexperimentation.v1.AbortFaultConfig, options?: $protobuf.IConversionOptions): { [k: string]: any };
/**
* Converts this AbortFaultConfig to JSON.
* @returns JSON object
*/
public toJSON(): { [k: string]: any };
}
/** Properties of a LatencyFaultConfig. */
interface ILatencyFaultConfig {
/** LatencyFaultConfig percent */
percent?: (number|null);
/** LatencyFaultConfig durationMs */
durationMs?: (number|null);
}
/** Represents a LatencyFaultConfig. */
class LatencyFaultConfig implements ILatencyFaultConfig {
/**
* Constructs a new LatencyFaultConfig.
* @param [properties] Properties to set
*/
constructor(properties?: clutch.chaos.serverexperimentation.v1.ILatencyFaultConfig);
/** LatencyFaultConfig percent. */
public percent: number;
/** LatencyFaultConfig durationMs. */
public durationMs: number;
/**
* Verifies a LatencyFaultConfig message.
* @param message Plain object to verify
* @returns `null` if valid, otherwise the reason why it is not
*/
public static verify(message: { [k: string]: any }): (string|null);
/**
* Creates a LatencyFaultConfig message from a plain object. Also converts values to their respective internal types.
* @param object Plain object
* @returns LatencyFaultConfig
*/
public static fromObject(object: { [k: string]: any }): clutch.chaos.serverexperimentation.v1.LatencyFaultConfig;
/**
* Creates a plain object from a LatencyFaultConfig message. Also converts values to other types if specified.
* @param message LatencyFaultConfig
* @param [options] Conversion options
* @returns Plain object
*/
public static toObject(message: clutch.chaos.serverexperimentation.v1.LatencyFaultConfig, options?: $protobuf.IConversionOptions): { [k: string]: any };
/**
* Converts this LatencyFaultConfig to JSON.
* @returns JSON object
*/
public toJSON(): { [k: string]: any };
}
/** FaultInjectionCluster enum. */
enum FaultInjectionCluster {
FAULTINJECTIONCLUSTER_UNSPECIFIED = 0,
FAULTINJECTIONCLUSTER_DOWNSTREAM = 1,
FAULTINJECTIONCLUSTER_UPSTREAM = 2
}
/** Properties of a HTTPFaultConfig. */
interface IHTTPFaultConfig {
 
......
This diff is collapsed.
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment