From 00727ae4876bab1d5ab1fdbbcbd5ba0ed315f2e0 Mon Sep 17 00:00:00 2001 From: "oliver.michels" Date: Sat, 10 Apr 2021 21:08:25 +0200 Subject: [PATCH] all functions consistent to use PostgreSQL --- modules/azure/postgresql.go | 38 +++++++++---------- modules/azure/postgresql_test.go | 4 +- ...terraform_azure_postgresql_example_test.go | 2 +- 3 files changed, 22 insertions(+), 22 deletions(-) diff --git a/modules/azure/postgresql.go b/modules/azure/postgresql.go index 4c1f5222a..d9f3b47f9 100644 --- a/modules/azure/postgresql.go +++ b/modules/azure/postgresql.go @@ -31,17 +31,17 @@ func GetPostgreSQLServerClientE(subscriptionID string) (*postgresql.ServersClien return &postgresqlClient, nil } -// GetPostgresqlServer is a helper function that gets the server. +// GetPostgreSQLServer is a helper function that gets the server. // This function would fail the test if there is an error. -func GetPostgresqlServer(t testing.TestingT, resGroupName string, serverName string, subscriptionID string) *postgresql.Server { - postgresqlServer, err := GetPostgresqlServerE(t, subscriptionID, resGroupName, serverName) +func GetPostgreSQLServer(t testing.TestingT, resGroupName string, serverName string, subscriptionID string) *postgresql.Server { + postgresqlServer, err := GetPostgreSQLServerE(t, subscriptionID, resGroupName, serverName) require.NoError(t, err) return postgresqlServer } -// GetPostgresqlServerE is a helper function that gets the server. -func GetPostgresqlServerE(t testing.TestingT, subscriptionID string, resGroupName string, serverName string) (*postgresql.Server, error) { +// GetPostgreSQLServerE is a helper function that gets the server. +func GetPostgreSQLServerE(t testing.TestingT, subscriptionID string, resGroupName string, serverName string) (*postgresql.Server, error) { // Create a postgresql Server client postgresqlClient, err := GetPostgreSQLServerClientE(subscriptionID) if err != nil { @@ -58,8 +58,8 @@ func GetPostgresqlServerE(t testing.TestingT, subscriptionID string, resGroupNam return &postgresqlServer, nil } -// GetPostgresqlDBClientE is a helper function that will setup a postgresql DB client. -func GetPostgresqlDBClientE(subscriptionID string) (*postgresql.DatabasesClient, error) { +// GetPostgreSQLDBClientE is a helper function that will setup a postgresql DB client. +func GetPostgreSQLDBClientE(subscriptionID string) (*postgresql.DatabasesClient, error) { // Validate Azure subscription ID subscriptionID, err := getTargetAzureSubscription(subscriptionID) if err != nil { @@ -81,19 +81,19 @@ func GetPostgresqlDBClientE(subscriptionID string) (*postgresql.DatabasesClient, return &postgresqlDBClient, nil } -//GetPostgresqlDB is a helper function that gets the database. +//GetPostgreSQLDB is a helper function that gets the database. // This function would fail the test if there is an error. -func GetPostgresqlDB(t testing.TestingT, resGroupName string, serverName string, dbName string, subscriptionID string) *postgresql.Database { - database, err := GetPostgresqlDBE(t, subscriptionID, resGroupName, serverName, dbName) +func GetPostgreSQLDB(t testing.TestingT, resGroupName string, serverName string, dbName string, subscriptionID string) *postgresql.Database { + database, err := GetPostgreSQLDBE(t, subscriptionID, resGroupName, serverName, dbName) require.NoError(t, err) return database } -//GetPostgresqlDBE is a helper function that gets the database. -func GetPostgresqlDBE(t testing.TestingT, subscriptionID string, resGroupName string, serverName string, dbName string) (*postgresql.Database, error) { +//GetPostgreSQLDBE is a helper function that gets the database. +func GetPostgreSQLDBE(t testing.TestingT, subscriptionID string, resGroupName string, serverName string, dbName string) (*postgresql.Database, error) { // Create a postgresql db client - postgresqldbClient, err := GetPostgresqlDBClientE(subscriptionID) + postgresqldbClient, err := GetPostgreSQLDBClientE(subscriptionID) if err != nil { return nil, err } @@ -108,18 +108,18 @@ func GetPostgresqlDBE(t testing.TestingT, subscriptionID string, resGroupName st return &postgresqlDb, nil } -//ListPostgresqlDB is a helper function that gets all databases per server. -func ListPostgresqlDB(t testing.TestingT, subscriptionID string, resGroupName string, serverName string) []postgresql.Database { - dblist, err := ListPostgresqlDBE(t, subscriptionID, resGroupName, serverName) +//ListPostgreSQLDB is a helper function that gets all databases per server. +func ListPostgreSQLDB(t testing.TestingT, subscriptionID string, resGroupName string, serverName string) []postgresql.Database { + dblist, err := ListPostgreSQLDBE(t, subscriptionID, resGroupName, serverName) require.NoError(t, err) return dblist } -//ListPostgresqlDBE is a helper function that gets all databases per server. -func ListPostgresqlDBE(t testing.TestingT, subscriptionID string, resGroupName string, serverName string) ([]postgresql.Database, error) { +//ListPostgreSQLDBE is a helper function that gets all databases per server. +func ListPostgreSQLDBE(t testing.TestingT, subscriptionID string, resGroupName string, serverName string) ([]postgresql.Database, error) { // Create a postgresql db client - postgresqldbClient, err := GetPostgresqlDBClientE(subscriptionID) + postgresqldbClient, err := GetPostgreSQLDBClientE(subscriptionID) if err != nil { return nil, err } diff --git a/modules/azure/postgresql_test.go b/modules/azure/postgresql_test.go index a81c0f373..5355fd441 100644 --- a/modules/azure/postgresql_test.go +++ b/modules/azure/postgresql_test.go @@ -23,7 +23,7 @@ func TestGetPostgreSQLServerE(t *testing.T) { serverName := "" subscriptionID := "" - _, err := GetPostgresqlServerE(t, subscriptionID, resGroupName, serverName) + _, err := GetPostgreSQLServerE(t, subscriptionID, resGroupName, serverName) require.Error(t, err) } @@ -35,6 +35,6 @@ func TestGetPostgreSQLDBE(t *testing.T) { subscriptionID := "" dbName := "" - _, err := GetPostgresqlDBE(t, subscriptionID, resGroupName, serverName, dbName) + _, err := GetPostgreSQLDBE(t, subscriptionID, resGroupName, serverName, dbName) require.Error(t, err) } diff --git a/test/azure/terraform_azure_postgresql_example_test.go b/test/azure/terraform_azure_postgresql_example_test.go index 044152d8a..e272748fe 100644 --- a/test/azure/terraform_azure_postgresql_example_test.go +++ b/test/azure/terraform_azure_postgresql_example_test.go @@ -39,7 +39,7 @@ func TestPostgreSQLDatabase(t *testing.T) { expectedSkuName := terraform.Output(t, terraformOptions, "sku_name") // website::tag::4:: Get the Server details and assert them against the terraform output - actualServer := azure.GetPostgresqlServer(t, rgName, actualServername, subscriptionID) + actualServer := azure.GetPostgreSQLServer(t, rgName, actualServername, subscriptionID) // Verify assert.NotNil(t, actualServer) assert.Equal(t, expectedServername, actualServername)