diff --git a/server/etcdmain/config_test.go b/server/etcdmain/config_test.go index e1989e0ddc8..5545c62966a 100644 --- a/server/etcdmain/config_test.go +++ b/server/etcdmain/config_test.go @@ -657,19 +657,28 @@ func validateClusteringFlags(t *testing.T, cfg *config) { } func TestConfigFileDeprecatedOptions(t *testing.T) { + // Define a minimal config struct with only the fields we need + type configFileYAML struct { + SnapshotCount uint64 `json:"snapshot-count,omitempty"` + MaxSnapFiles uint `json:"max-snapshots,omitempty"` + ExperimentalCompactHashCheckEnabled bool `json:"experimental-compact-hash-check-enabled,omitempty"` + ExperimentalCompactHashCheckTime time.Duration `json:"experimental-compact-hash-check-time,omitempty"` + ExperimentalWarningUnaryRequestDuration time.Duration `json:"experimental-warning-unary-request-duration,omitempty"` + } + testCases := []struct { name string - configFileYAML embed.Config + configFileYAML configFileYAML expectedFlags map[string]struct{} }{ { name: "no deprecated options", - configFileYAML: embed.Config{}, + configFileYAML: configFileYAML{}, expectedFlags: map[string]struct{}{}, }, { name: "deprecated experimental options", - configFileYAML: embed.Config{ + configFileYAML: configFileYAML{ ExperimentalCompactHashCheckEnabled: true, ExperimentalCompactHashCheckTime: 2 * time.Minute, ExperimentalWarningUnaryRequestDuration: time.Second, @@ -677,12 +686,11 @@ func TestConfigFileDeprecatedOptions(t *testing.T) { expectedFlags: map[string]struct{}{ "experimental-compact-hash-check-enabled": {}, "experimental-compact-hash-check-time": {}, - // experimental-warning-unary-request-duration is handled differently }, }, { name: "deprecated snapshot options", - configFileYAML: embed.Config{ + configFileYAML: configFileYAML{ SnapshotCount: 10000, MaxSnapFiles: 5, }, @@ -728,8 +736,6 @@ func TestConfigFileDeprecatedOptions(t *testing.T) { // Special check for experimental-warning-unary-request-duration if tc.configFileYAML.ExperimentalWarningUnaryRequestDuration != 0 { - // Verify that the warning was logged, but don't require it to be in FlagsExplicitlySet - // The warning is handled in a different way in the code t.Log("Note: experimental-warning-unary-request-duration deprecation is handled separately") } })