From dcb1b744ce0fd0544369278cd7a4d8fc41531177 Mon Sep 17 00:00:00 2001 From: r3gardless Date: Sun, 20 Oct 2024 21:10:51 +0900 Subject: [PATCH] fix : rename quota to quote --- ddosify_engine/README.md | 6 +++--- .../config/config_testdata/config_data_csv.json | 2 +- ddosify_engine/config/json.go | 6 +++--- ddosify_engine/config_examples/config.json | 2 +- ddosify_engine/core/engine_test.go | 2 +- ddosify_engine/core/scenario/data/csv.go | 2 +- ddosify_engine/core/scenario/data/csv_test.go | 10 +++++----- ddosify_engine/core/types/hammer.go | 2 +- ddosify_engine/core/types/hammer_test.go | 2 +- 9 files changed, 17 insertions(+), 17 deletions(-) diff --git a/ddosify_engine/README.md b/ddosify_engine/README.md index c828259b..725e1c59 100644 --- a/ddosify_engine/README.md +++ b/ddosify_engine/README.md @@ -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 @@ -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 | @@ -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 } diff --git a/ddosify_engine/config/config_testdata/config_data_csv.json b/ddosify_engine/config/config_testdata/config_data_csv.json index 24d5bbf8..283f8e00 100644 --- a/ddosify_engine/config/config_testdata/config_data_csv.json +++ b/ddosify_engine/config/config_testdata/config_data_csv.json @@ -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 } diff --git a/ddosify_engine/config/json.go b/ddosify_engine/config/json.go index 7ae3b3fa..898db89d 100644 --- a/ddosify_engine/config/json.go +++ b/ddosify_engine/config/json.go @@ -130,7 +130,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"` } @@ -138,7 +138,7 @@ 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" @@ -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, } } diff --git a/ddosify_engine/config_examples/config.json b/ddosify_engine/config_examples/config.json index 59a1bc2d..ae153869 100644 --- a/ddosify_engine/config_examples/config.json +++ b/ddosify_engine/config_examples/config.json @@ -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 diff --git a/ddosify_engine/core/engine_test.go b/ddosify_engine/core/engine_test.go index d5748e03..1d036c07 100644 --- a/ddosify_engine/core/engine_test.go +++ b/ddosify_engine/core/engine_test.go @@ -1803,7 +1803,7 @@ func TestLoadRandomInfoFromData(t *testing.T) { }, }, SkipEmptyLine: false, - AllowQuota: false, + AllowQuote: false, Order: "", }, } diff --git a/ddosify_engine/core/scenario/data/csv.go b/ddosify_engine/core/scenario/data/csv.go index 1d5d38d9..64b72e52 100644 --- a/ddosify_engine/core/scenario/data/csv.go +++ b/ddosify_engine/core/scenario/data/csv.go @@ -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 { diff --git a/ddosify_engine/core/scenario/data/csv_test.go b/ddosify_engine/core/scenario/data/csv_test.go index 25ee1bc1..ca4235d2 100644 --- a/ddosify_engine/core/scenario/data/csv_test.go +++ b/ddosify_engine/core/scenario/data/csv_test.go @@ -20,7 +20,7 @@ func TestValidateCsvConf(t *testing.T) { SkipFirstLine: false, Vars: map[string]types.Tag{}, SkipEmptyLine: false, - AllowQuota: false, + AllowQuote: false, Order: "", } @@ -46,7 +46,7 @@ func TestReadCsv_RemoteErr(t *testing.T) { "6": {Tag: "boolField", Type: "bool"}, }, SkipEmptyLine: true, - AllowQuota: true, + AllowQuote: true, Order: "sequential", } @@ -104,7 +104,7 @@ func TestReadCsvFromRemote(t *testing.T) { "6": {Tag: "boolField", Type: "bool"}, }, SkipEmptyLine: true, - AllowQuota: true, + AllowQuote: true, Order: "sequential", } @@ -135,7 +135,7 @@ func TestReadCsv(t *testing.T) { "6": {Tag: "boolField", Type: "bool"}, }, SkipEmptyLine: true, - AllowQuota: true, + AllowQuote: true, Order: "sequential", } @@ -205,7 +205,7 @@ var table = []struct { "6": {Tag: "boolField", Type: "bool"}, }, SkipEmptyLine: true, - AllowQuota: true, + AllowQuote: true, Order: "sequential", }, }, diff --git a/ddosify_engine/core/types/hammer.go b/ddosify_engine/core/types/hammer.go index f2cf8b90..def0a7c5 100644 --- a/ddosify_engine/core/types/hammer.go +++ b/ddosify_engine/core/types/hammer.go @@ -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"` } diff --git a/ddosify_engine/core/types/hammer_test.go b/ddosify_engine/core/types/hammer_test.go index 57645039..7bca4c54 100644 --- a/ddosify_engine/core/types/hammer_test.go +++ b/ddosify_engine/core/types/hammer_test.go @@ -338,7 +338,7 @@ func TestHammerAccessingNotDefinedCsvEnvs(t *testing.T) { }, }, SkipEmptyLine: false, - AllowQuota: false, + AllowQuote: false, Order: "", }