Skip to content

Commit

Permalink
fix : rename quota to quote
Browse files Browse the repository at this point in the history
  • Loading branch information
R3gardless authored and kakao-edgar-p committed Oct 20, 2024
1 parent 78214b2 commit dcb1b74
Show file tree
Hide file tree
Showing 9 changed files with 17 additions and 17 deletions.
6 changes: 3 additions & 3 deletions ddosify_engine/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -403,7 +403,7 @@ There is an example config file at [config_examples/config.json](https://github.
"3":{"tag":"payload", "type":"json"},
"4":{"tag":"age", "type":"int"}
},
"allow_quota" : true,
"allow_quote" : true,
"order": "sequential",
"skip_first_line" : true,
"skip_empty_line" : true
Expand All @@ -416,7 +416,7 @@ There is an example config file at [config_examples/config.json](https://github.
| `path` | Local path or remote url for your CSV file | `string` | - | Yes |
| `delimiter` | Delimiter for reading CSV | `string` | `,` | No |
| `vars` | Tag columns using column index as key, use `type` field if you want to cast a column to a specific type, default is `string`, can be one of the following: `json`, `int`, `float`,`bool`. | `map` | - | Yes |
| `allow_quota` | If set to true, a quote may appear in an unquoted field and a non-doubled quote may appear in a quoted field | `bool` | `false` | No |
| `allow_quote` | If set to true, a quote may appear in an unquoted field and a non-doubled quote may appear in a quoted field | `bool` | `false` | No |
| `order` | Order of reading records from CSV. Can be `random` or `sequential` | `string` | `random` | No |
| `skip_first_line` | Skips first line while reading records from CSV. | `bool` | `false` | No |
| `skip_empty_line` | Skips empty lines while reading records from CSV. | `bool` | `true` | No |
Expand Down Expand Up @@ -1088,7 +1088,7 @@ We are using this [CSV data](https://github.com/getanteon/anteon/tree/master/ddo
"3":{"tag":"payload", "type":"json"},
"4":{"tag":"age", "type":"int"}
},
"allow_quota" : true,
"allow_quote" : true,
"order": "random",
"skip_first_line" : true
}
Expand Down
2 changes: 1 addition & 1 deletion ddosify_engine/config/config_testdata/config_data_csv.json
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@
"3":{"tag":"payload", "type":"json"},
"4":{"tag":"age", "type":"int"}
},
"allow_quota" : true,
"allow_quote" : true,
"order": "random",
"skip_first_line" : true
}
Expand Down
6 changes: 3 additions & 3 deletions ddosify_engine/config/json.go
Original file line number Diff line number Diff line change
Expand Up @@ -130,15 +130,15 @@ type CsvConf struct {
SkipFirstLine bool `json:"skip_first_line"`
Vars map[string]Tag `json:"vars"` // "0":"name", "1":"city","2":"team"
SkipEmptyLine bool `json:"skip_empty_line"`
AllowQuota bool `json:"allow_quota"`
AllowQuote bool `json:"allow_quote"`
Order string `json:"order"`
}

func (c *CsvConf) UnmarshalJSON(data []byte) error {
// default values
c.SkipEmptyLine = true
c.SkipFirstLine = false
c.AllowQuota = false
c.AllowQuote = false
c.Delimiter = ","
c.Order = "random"

Expand Down Expand Up @@ -288,7 +288,7 @@ func (j *JsonReader) CreateHammer() (h types.Hammer, err error) {
SkipFirstLine: val.SkipFirstLine,
Vars: vars,
SkipEmptyLine: val.SkipEmptyLine,
AllowQuota: val.AllowQuota,
AllowQuote: val.AllowQuote,
Order: val.Order,
}
}
Expand Down
2 changes: 1 addition & 1 deletion ddosify_engine/config_examples/config.json
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@
"3":{"tag":"payload", "type":"json"},
"4":{"tag":"age", "type":"int"}
},
"allow_quota" : true,
"allow_quote" : true,
"order": "random",
"skip_first_line" : true,
"skip_empty_line" : true
Expand Down
2 changes: 1 addition & 1 deletion ddosify_engine/core/engine_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -1803,7 +1803,7 @@ func TestLoadRandomInfoFromData(t *testing.T) {
},
},
SkipEmptyLine: false,
AllowQuota: false,
AllowQuote: false,
Order: "",
},
}
Expand Down
2 changes: 1 addition & 1 deletion ddosify_engine/core/scenario/data/csv.go
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,7 @@ func ReadCsv(conf types.CsvConf) ([]map[string]interface{}, error) {
csvReader := csv.NewReader(reader)
csvReader.Comma = []rune(conf.Delimiter)[0]
csvReader.TrimLeadingSpace = true
csvReader.LazyQuotes = conf.AllowQuota
csvReader.LazyQuotes = conf.AllowQuote

data, err := csvReader.ReadAll()
if err != nil {
Expand Down
10 changes: 5 additions & 5 deletions ddosify_engine/core/scenario/data/csv_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ func TestValidateCsvConf(t *testing.T) {
SkipFirstLine: false,
Vars: map[string]types.Tag{},
SkipEmptyLine: false,
AllowQuota: false,
AllowQuote: false,
Order: "",
}

Expand All @@ -46,7 +46,7 @@ func TestReadCsv_RemoteErr(t *testing.T) {
"6": {Tag: "boolField", Type: "bool"},
},
SkipEmptyLine: true,
AllowQuota: true,
AllowQuote: true,
Order: "sequential",
}

Expand Down Expand Up @@ -104,7 +104,7 @@ func TestReadCsvFromRemote(t *testing.T) {
"6": {Tag: "boolField", Type: "bool"},
},
SkipEmptyLine: true,
AllowQuota: true,
AllowQuote: true,
Order: "sequential",
}

Expand Down Expand Up @@ -135,7 +135,7 @@ func TestReadCsv(t *testing.T) {
"6": {Tag: "boolField", Type: "bool"},
},
SkipEmptyLine: true,
AllowQuota: true,
AllowQuote: true,
Order: "sequential",
}

Expand Down Expand Up @@ -205,7 +205,7 @@ var table = []struct {
"6": {Tag: "boolField", Type: "bool"},
},
SkipEmptyLine: true,
AllowQuota: true,
AllowQuote: true,
Order: "sequential",
},
},
Expand Down
2 changes: 1 addition & 1 deletion ddosify_engine/core/types/hammer.go
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,7 @@ type CsvConf struct {
SkipFirstLine bool `json:"skip_first_line"`
Vars map[string]Tag `json:"vars"` // "0":"name", "1":"city","2":"team"
SkipEmptyLine bool `json:"skip_empty_line"`
AllowQuota bool `json:"allow_quota"`
AllowQuote bool `json:"allow_quote"`
Order string `json:"order"`
}

Expand Down
2 changes: 1 addition & 1 deletion ddosify_engine/core/types/hammer_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -338,7 +338,7 @@ func TestHammerAccessingNotDefinedCsvEnvs(t *testing.T) {
},
},
SkipEmptyLine: false,
AllowQuota: false,
AllowQuote: false,
Order: "",
}

Expand Down

0 comments on commit dcb1b74

Please sign in to comment.