-
Notifications
You must be signed in to change notification settings - Fork 112
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Chore: unify sql data driver implementation (#873)
- Loading branch information
Showing
5 changed files
with
302 additions
and
563 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -72,16 +72,6 @@ jobs: | |
mysql database: 'kubevela' | ||
mysql root password: 'kubevelaSQL123' | ||
|
||
- name: Set up OpenGauss | ||
uses: lgj101/[email protected] | ||
with: | ||
GS_VERSION: '5.0.0' | ||
GS_DB: 'kubevela' | ||
GS_USERNAME: 'kubevela' | ||
GS_PASSWORD: 'Kubevela-123' | ||
HOST_PORT: 15432 | ||
CONTAINER_PORT: 5432 | ||
|
||
- name: Set up Postgres | ||
uses: Harmon758/postgresql-action@v1 | ||
with: | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -90,28 +90,6 @@ func initPostgresTestDs() (datastore.DataStore, error) { | |
return postgresDriver, nil | ||
} | ||
|
||
// initOpenGaussTestDs Postgres Driver is also compatible with OpenGaussian databases | ||
func initOpenGaussTestDs() (datastore.DataStore, error) { | ||
db, err := gorm.Open(postgresorm.Open("postgres://gaussdb:[email protected]:15432/kubevela?sslmode=disable&client_encoding=UTF-8&connect_timeout=1"), &gorm.Config{}) | ||
if err != nil { | ||
return nil, err | ||
} | ||
for _, v := range model.GetRegisterModels() { | ||
err := db.Migrator().DropTable(&v) | ||
if err != nil { | ||
return nil, err | ||
} | ||
} | ||
openGaussDriver, err := postgres.New(context.TODO(), datastore.Config{ | ||
URL: "postgres://gaussdb:[email protected]:15432/kubevela?sslmode=disable&client_encoding=UTF-8&connect_timeout=1", | ||
Database: "kubevela", | ||
}) | ||
if err != nil { | ||
return nil, err | ||
} | ||
return openGaussDriver, nil | ||
} | ||
|
||
func initKubeapiTestDs() (datastore.DataStore, error) { | ||
var testScheme = runtime.NewScheme() | ||
testEnv := &envtest.Environment{ | ||
|
@@ -196,7 +174,6 @@ var _ = Describe("Test datastore methods", func() { | |
DriverTest(initMysqlTestDs) | ||
DriverTest(initMongodbTestDs) | ||
DriverTest(initKubeapiTestDs) | ||
DriverTest(initOpenGaussTestDs) | ||
DriverTest(initPostgresTestDs) | ||
}) | ||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.