Skip to content

Commit 2d1cd07

Browse files
committed
refactor(cmd): use SDK enum constants in remaining lifecycle tests
The previous commit migrated multi_service_engine_versions_test.go to use rdstypes.LifecycleSupportNameOpenSourceRdsExtendedSupport instead of the bare "open-source-rds-extended-support" string literal. Three sibling test files in cmd/ still hard-coded the same strings, so a future SDK enum rename would have left them out of sync. Migrate all remaining occurrences in: - cmd/multi_service_coverage_test.go (3 sites) - cmd/multi_service_test.go (3 sites) - cmd/multi_service_engine_versions_paginate_test.go (1 site, typed directly because the SDK struct exposes the enum type, not string) No production behaviour changes; tests still pass (`go test ./cmd/...`).
1 parent a068c3c commit 2d1cd07

3 files changed

Lines changed: 8 additions & 7 deletions

File tree

‎cmd/multi_service_coverage_test.go‎

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -246,7 +246,7 @@ func TestIsInExtendedSupport_EdgeCases(t *testing.T) {
246246
MajorEngineVersion: "5.7",
247247
SupportedEngineLifecycles: []EngineLifecycleInfo{
248248
{
249-
LifecycleSupportName: "open-source-rds-extended-support",
249+
LifecycleSupportName: string(rdstypes.LifecycleSupportNameOpenSourceRdsExtendedSupport),
250250
LifecycleSupportStartDate: pastDate,
251251
LifecycleSupportEndDate: futureDate,
252252
},
@@ -257,7 +257,7 @@ func TestIsInExtendedSupport_EdgeCases(t *testing.T) {
257257
MajorEngineVersion: "8.0",
258258
SupportedEngineLifecycles: []EngineLifecycleInfo{
259259
{
260-
LifecycleSupportName: "open-source-rds-standard-support",
260+
LifecycleSupportName: string(rdstypes.LifecycleSupportNameOpenSourceRdsStandardSupport),
261261
LifecycleSupportStartDate: now.AddDate(-2, 0, 0),
262262
LifecycleSupportEndDate: futureDate,
263263
},
@@ -318,7 +318,7 @@ func TestAdjustRecommendationForExcludedVersions_AdditionalCases(t *testing.T) {
318318
MajorEngineVersion: "5.7",
319319
SupportedEngineLifecycles: []EngineLifecycleInfo{
320320
{
321-
LifecycleSupportName: "open-source-rds-extended-support",
321+
LifecycleSupportName: string(rdstypes.LifecycleSupportNameOpenSourceRdsExtendedSupport),
322322
LifecycleSupportStartDate: pastDate,
323323
LifecycleSupportEndDate: futureDate,
324324
},

‎cmd/multi_service_engine_versions_paginate_test.go‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,7 @@ func rdsMajorVersion(engine, major string) rdstypes.DBMajorEngineVersion { //nol
5151
MajorEngineVersion: aws.String(major),
5252
SupportedEngineLifecycles: []rdstypes.SupportedEngineLifecycle{
5353
{
54-
LifecycleSupportName: "open-source-rds-extended-support",
54+
LifecycleSupportName: rdstypes.LifecycleSupportNameOpenSourceRdsExtendedSupport,
5555
LifecycleSupportStartDate: aws.Time(time.Now().AddDate(-1, 0, 0)),
5656
LifecycleSupportEndDate: aws.Time(time.Now().AddDate(2, 0, 0)),
5757
},

‎cmd/multi_service_test.go‎

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@ import (
1212

1313
"github.com/LeanerCloud/CUDly/pkg/common"
1414
"github.com/aws/aws-sdk-go-v2/aws"
15+
rdstypes "github.com/aws/aws-sdk-go-v2/service/rds/types"
1516
"github.com/stretchr/testify/assert"
1617
"github.com/stretchr/testify/mock"
1718
"github.com/stretchr/testify/require"
@@ -1828,12 +1829,12 @@ func createTestVersionInfo() map[string]MajorEngineVersionInfo {
18281829
MajorEngineVersion: "5.7",
18291830
SupportedEngineLifecycles: []EngineLifecycleInfo{
18301831
{
1831-
LifecycleSupportName: "open-source-rds-standard-support",
1832+
LifecycleSupportName: string(rdstypes.LifecycleSupportNameOpenSourceRdsStandardSupport),
18321833
LifecycleSupportStartDate: now.AddDate(-5, 0, 0),
18331834
LifecycleSupportEndDate: pastDate,
18341835
},
18351836
{
1836-
LifecycleSupportName: "open-source-rds-extended-support",
1837+
LifecycleSupportName: string(rdstypes.LifecycleSupportNameOpenSourceRdsExtendedSupport),
18371838
LifecycleSupportStartDate: pastDate,
18381839
LifecycleSupportEndDate: futureDate,
18391840
},
@@ -1844,7 +1845,7 @@ func createTestVersionInfo() map[string]MajorEngineVersionInfo {
18441845
MajorEngineVersion: "8.0",
18451846
SupportedEngineLifecycles: []EngineLifecycleInfo{
18461847
{
1847-
LifecycleSupportName: "open-source-rds-standard-support",
1848+
LifecycleSupportName: string(rdstypes.LifecycleSupportNameOpenSourceRdsStandardSupport),
18481849
LifecycleSupportStartDate: now.AddDate(-2, 0, 0),
18491850
LifecycleSupportEndDate: futureDate,
18501851
},

0 commit comments

Comments
 (0)