Skip to content

Commit

Permalink
feat(kafka_quota): changed request_percentage field to float type
Browse files Browse the repository at this point in the history
  • Loading branch information
vmyroslav committed Jan 8, 2025
1 parent 0759bfb commit b77ed58
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 5 deletions.
2 changes: 1 addition & 1 deletion internal/sdkprovider/service/kafka/kafka_quota.go
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@ Exceeding this limit results in client throttling.`,
AtLeastOneOf: []string{"consumer_byte_rate", "producer_byte_rate", "request_percentage"},
},
"request_percentage": {
Type: schema.TypeInt,
Type: schema.TypeFloat,
Optional: true,
Description: `
Sets the maximum percentage of CPU time that a client group can use on request handler I/O and network threads per broker within a quota window.
Expand Down
8 changes: 4 additions & 4 deletions internal/sdkprovider/service/kafka/kafka_quota_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -282,13 +282,13 @@ resource "aiven_kafka_quota" "{{ .resource_name }}" {
"client_id": clientID,
"consumer_byte_rate": 4000,
"producer_byte_rate": 4000,
"request_percentage": 40,
"request_percentage": 40.5,
}).
Add("kafka_quota", map[string]any{
"resource_name": "user",
"service_name": serviceName,
"user": user,
"request_percentage": 20,
"request_percentage": 20.22,
}).
Add("kafka_quota", map[string]any{
"resource_name": "client",
Expand All @@ -304,12 +304,12 @@ resource "aiven_kafka_quota" "{{ .resource_name }}" {
resource.TestCheckResourceAttr(fmt.Sprintf("%s.new_full", kafkaQuotaResource), "client_id", clientID),
resource.TestCheckResourceAttr(fmt.Sprintf("%s.new_full", kafkaQuotaResource), "consumer_byte_rate", "4000"),
resource.TestCheckResourceAttr(fmt.Sprintf("%s.new_full", kafkaQuotaResource), "producer_byte_rate", "4000"),
resource.TestCheckResourceAttr(fmt.Sprintf("%s.new_full", kafkaQuotaResource), "request_percentage", "40"),
resource.TestCheckResourceAttr(fmt.Sprintf("%s.new_full", kafkaQuotaResource), "request_percentage", "40.5"),

resource.TestCheckResourceAttr(fmt.Sprintf("%s.user", kafkaQuotaResource), "project", projectName),
resource.TestCheckResourceAttr(fmt.Sprintf("%s.user", kafkaQuotaResource), "service_name", serviceName),
resource.TestCheckResourceAttr(fmt.Sprintf("%s.user", kafkaQuotaResource), "user", user),
resource.TestCheckResourceAttr(fmt.Sprintf("%s.user", kafkaQuotaResource), "request_percentage", "20"),
resource.TestCheckResourceAttr(fmt.Sprintf("%s.user", kafkaQuotaResource), "request_percentage", "20.22"),
resource.TestCheckNoResourceAttr(fmt.Sprintf("%s.user", kafkaQuotaResource), "client_id"),
resource.TestCheckNoResourceAttr(fmt.Sprintf("%s.user", kafkaQuotaResource), "consumer_byte_rate"),
resource.TestCheckNoResourceAttr(fmt.Sprintf("%s.user", kafkaQuotaResource), "producer_byte_rate"),
Expand Down

0 comments on commit b77ed58

Please sign in to comment.