diff --git a/src/go/rpk/pkg/cli/cmd/cluster/config/export.go b/src/go/rpk/pkg/cli/cmd/cluster/config/export.go index adc747bd0c44..7b45671fd864 100644 --- a/src/go/rpk/pkg/cli/cmd/cluster/config/export.go +++ b/src/go/rpk/pkg/cli/cmd/cluster/config/export.go @@ -99,8 +99,6 @@ func exportConfig( } else { scalarVal := "" switch x := curValue.(type) { - case int: - scalarVal = strconv.Itoa(x) case float64: scalarVal = strconv.FormatFloat(x, 'f', -1, 64) case string: diff --git a/src/go/rpk/pkg/cli/cmd/cluster/config/get.go b/src/go/rpk/pkg/cli/cmd/cluster/config/get.go index bf7966407714..e098badca95f 100644 --- a/src/go/rpk/pkg/cli/cmd/cluster/config/get.go +++ b/src/go/rpk/pkg/cli/cmd/cluster/config/get.go @@ -46,6 +46,13 @@ output, use the 'edit' and 'export' commands respectively.`, if !exists { out.Die("Property '%s' not found", key) } else { + // currentConfig is the result of json.Unmarshal into a + // map[string]interface{}. Due to json rules, all numbers + // are float64. We do not want to print floats, especially + // for large numbers. + if f64, ok := val.(float64); ok { + val = int64(f64) + } // Intentionally bare output, so that the output can be readily // consumed in a script. bytes, err := yaml.Marshal(val) diff --git a/tests/rptest/tests/cluster_config_test.py b/tests/rptest/tests/cluster_config_test.py index 8e3ce71d2d6b..f968db328d42 100644 --- a/tests/rptest/tests/cluster_config_test.py +++ b/tests/rptest/tests/cluster_config_test.py @@ -939,11 +939,6 @@ def yamlize(input) -> str: expect_cli_readback = yamlize(e.yamlval) - # Hack around scientific notation for large int values. - # This may be an RPK bug? - if cli_readback.find("e+") != -1: - cli_readback = str(int(float(cli_readback))) - self.logger.info( f"CLI readback '{cli_readback}' expect '{expect_cli_readback}'" ) diff --git a/tests/rptest/tests/rpk_start_test.py b/tests/rptest/tests/rpk_start_test.py index e978693e0b1a..f2c62cfaba86 100644 --- a/tests/rptest/tests/rpk_start_test.py +++ b/tests/rptest/tests/rpk_start_test.py @@ -71,9 +71,7 @@ def test_container_mode(self): expected_cluster_properties = { "auto_create_topics_enabled": "true", "group_topic_partitions": "3", - # RPK returns scientific notation for large int values. - # https://github.com/redpanda-data/redpanda/issues/6070 - "storage_min_free_bytes": "1.048576e+07", + "storage_min_free_bytes": "10485760", "topic_partitions_per_shard": "1000" }