From c6e74c27b826555f0a8940cb76f12664f9f54547 Mon Sep 17 00:00:00 2001 From: actiontech-zihan Date: Thu, 21 May 2026 16:09:01 +0000 Subject: [PATCH 1/2] feat(constant): add DBTypeOpenGauss + ParseDBType case for openGauss support (#2905) --- internal/dms/pkg/constant/const.go | 3 +++ 1 file changed, 3 insertions(+) diff --git a/internal/dms/pkg/constant/const.go b/internal/dms/pkg/constant/const.go index 18741600..591d4280 100644 --- a/internal/dms/pkg/constant/const.go +++ b/internal/dms/pkg/constant/const.go @@ -250,6 +250,8 @@ func ParseDBType(s string) (DBType, error) { return DBTypeDM, nil case "GaussDB": return DBTypeGaussDB, nil + case "openGauss", "OPENGAUSS", "opengauss": + return DBTypeOpenGauss, nil case "GaussDB for MySQL": return DBTypeGaussDBForMySQL, nil case "HANA": @@ -278,6 +280,7 @@ const ( DBTypeHive DBType = "Hive" DBTypeDM DBType = "达梦(DM)" DBTypeGaussDB DBType = "GaussDB" + DBTypeOpenGauss DBType = "openGauss" DBTypeGaussDBForMySQL DBType = "GaussDB for MySQL" DBTypeHANA DBType = "HANA" DBTypePolarDBForMySQL DBType = "PolarDB For MySQL" From 4e48dee504375e2b02d02819dd4906148409cfce Mon Sep 17 00:00:00 2001 From: actiontech-zihan Date: Thu, 21 May 2026 16:09:12 +0000 Subject: [PATCH 2/2] test(constant): assert ParseDBType resolves openGauss three-case + GaussDB regression (#2905) --- internal/dms/pkg/constant/const_test.go | 32 +++++++++++++++++++++++++ 1 file changed, 32 insertions(+) diff --git a/internal/dms/pkg/constant/const_test.go b/internal/dms/pkg/constant/const_test.go index 71c14a9b..6a9b9ce2 100644 --- a/internal/dms/pkg/constant/const_test.go +++ b/internal/dms/pkg/constant/const_test.go @@ -152,3 +152,35 @@ func TestParseDBType(t *testing.T) { }) } } + +func TestParseDBType_OpenGauss_EE(t *testing.T) { + cases := map[string]struct { + input string + want DBType + wantErr bool + }{ + "openGauss literal": {input: "openGauss", want: DBTypeOpenGauss, wantErr: false}, + "OPENGAUSS upper": {input: "OPENGAUSS", want: DBTypeOpenGauss, wantErr: false}, + "opengauss lower": {input: "opengauss", want: DBTypeOpenGauss, wantErr: false}, + "GaussDB regression": {input: "GaussDB", want: DBTypeGaussDB, wantErr: false}, + "GaussDB for MySQL regression": {input: "GaussDB for MySQL", want: DBTypeGaussDBForMySQL, wantErr: false}, + "Unknown returns explicit error": {input: "Unknown", want: DBType(""), wantErr: true}, + } + for name, tc := range cases { + t.Run(name, func(t *testing.T) { + got, err := ParseDBType(tc.input) + if tc.wantErr { + if err == nil { + t.Fatalf("expected error for input %q, got nil", tc.input) + } + return + } + if err != nil { + t.Fatalf("unexpected error for input %q: %v", tc.input, err) + } + if got != tc.want { + t.Fatalf("ParseDBType(%q): got %q, want %q", tc.input, got, tc.want) + } + }) + } +}