Skip to content

Commit

Permalink
test: fix TestConfigFileDeprecatedOptions
Browse files Browse the repository at this point in the history
Use minimal config struct for YAML marshaling.
Replace custom mapToSortedSlice with standard library functions.
Fix flag verification for deprecated experimental options.

Fixes etcd-io#19066

Signed-off-by: mansoora <[email protected]>
  • Loading branch information
mansoor17syed committed Jan 13, 2025
1 parent d398945 commit 1aa7863
Showing 1 changed file with 6 additions and 3 deletions.
9 changes: 6 additions & 3 deletions server/etcdmain/config_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -25,9 +25,9 @@ import (
"testing"
"time"

"github.com/stretchr/testify/assert"
"sigs.k8s.io/yaml"

"github.com/stretchr/testify/assert"
"go.etcd.io/etcd/pkg/v3/featuregate"
"go.etcd.io/etcd/pkg/v3/flags"
"go.etcd.io/etcd/server/v3/embed"
Expand Down Expand Up @@ -727,12 +727,15 @@ func TestConfigFileDeprecatedOptions(t *testing.T) {
}

// Compare sets of flags
assert.Equal(t, tc.expectedFlags, foundFlags, "deprecated flags mismatch")
assert.Equalf(t, tc.expectedFlags, foundFlags, "deprecated flags mismatch - expected: %v, got: %v",
tc.expectedFlags, foundFlags)

// Note: experimental-warning-unary-request-duration deprecation is handled
// through a separate mechanism in embed.Config
if tc.configFileYAML.ExperimentalWarningUnaryRequestDuration != 0 {
// Skip checking this flag as it's handled differently
assert.Equal(t, cfg.ec.WarningUnaryRequestDuration,
tc.configFileYAML.ExperimentalWarningUnaryRequestDuration,
"experimental warning duration should match")
}
})
}
Expand Down

0 comments on commit 1aa7863

Please sign in to comment.