diff --git a/controllers/mysql_combined_test.go b/controllers/mysql_combined_test.go index 834cb714cd2..5364931ecec 100644 --- a/controllers/mysql_combined_test.go +++ b/controllers/mysql_combined_test.go @@ -30,24 +30,19 @@ func TestMySQLHappyPath(t *testing.T) { rgLocation := "eastus2" rgName := tc.resourceGroupName mySQLServerName := GenerateTestResourceNameWithRandom("mysql-srv", 10) - // mySQLReplicaName := GenerateTestResourceNameWithRandom("mysql-rep", 10) + mySQLReplicaName := GenerateTestResourceNameWithRandom("mysql-rep", 10) // Create the mySQLServer object and expect the Reconcile to be created mySQLServerInstance := v1alpha2.NewDefaultMySQLServer(mySQLServerName, rgName, rgLocation) RequireInstance(ctx, t, tc, mySQLServerInstance) - // Commenting the replica creation out for now - the time to - // provision the replica has blown out to more than an hour in - // some cases? - // TODO (babbageclunk): raise a bug with the Azure MySQL team about this. + // Create a mySQL replica - // // Create a mySQL replica + mySQLReplicaInstance := v1alpha2.NewReplicaMySQLServer(mySQLReplicaName, rgName, rgLocation, mySQLServerInstance.Status.ResourceId) + mySQLReplicaInstance.Spec.StorageProfile = nil - // mySQLReplicaInstance := v1alpha2.NewReplicaMySQLServer(mySQLReplicaName, rgName, rgLocation, mySQLServerInstance.Status.ResourceId) - // mySQLReplicaInstance.Spec.StorageProfile = nil - - // EnsureInstance(ctx, t, tc, mySQLReplicaInstance) + EnsureInstance(ctx, t, tc, mySQLReplicaInstance) mySQLDBName := GenerateTestResourceNameWithRandom("mysql-db", 10) @@ -114,7 +109,7 @@ func TestMySQLHappyPath(t *testing.T) { EnsureDelete(ctx, t, tc, ruleInstance) EnsureDelete(ctx, t, tc, mySQLDBInstance) EnsureDelete(ctx, t, tc, mySQLServerInstance) - // EnsureDelete(ctx, t, tc, mySQLReplicaInstance) + EnsureDelete(ctx, t, tc, mySQLReplicaInstance) } func RunMySQLUserHappyPath(ctx context.Context, t *testing.T, mySQLServerName string, mySQLDBName string, rgName string) { diff --git a/pkg/resourcemanager/mysql/server/reconcile.go b/pkg/resourcemanager/mysql/server/reconcile.go index 21243609e50..2deb2196e4c 100644 --- a/pkg/resourcemanager/mysql/server/reconcile.go +++ b/pkg/resourcemanager/mysql/server/reconcile.go @@ -123,6 +123,7 @@ func (m *MySQLServerClient) Ensure(ctx context.Context, obj runtime.Object, opts instance.Status.ResourceId = *server.ID instance.Status.State = string(server.UserVisibleState) instance.Status.SpecHash = hash + instance.Status.PollingURL = "" return true, nil } } @@ -176,7 +177,7 @@ func (m *MySQLServerClient) Ensure(ctx context.Context, obj runtime.Object, opts if azerr.Type == errhelp.AsyncOpIncompleteError { instance.Status.PollingURL = pollURL } - instance.Status.Message = "Postgres server exists but may not be ready" + instance.Status.Message = "MySQL server exists but may not be ready" instance.Status.Provisioning = true return false, nil } @@ -185,14 +186,14 @@ func (m *MySQLServerClient) Ensure(ctx context.Context, obj runtime.Object, opts return false, nil } - // serious error occured, end reconcilliation and mark it as failed + // serious error occurred, end reconciliation and mark it as failed instance.Status.Message = errhelp.StripErrorIDs(err) instance.Status.Provisioned = false instance.Status.FailedProvisioning = true return true, nil - } + instance.Status.PollingURL = pollURL instance.Status.Message = "request submitted to Azure" } return false, nil