# Clusterctl test guide - All controllers tests are to check that all the resources we expect to be created are present in the kubernetes cluster after reconcilation. - You will set up the according test variables for your own test case and then set up your cluster specs - Let's use `TestClusterControllerSDSDistributed` as an example from `cluster_controller_test.go` - First, set up your test function: ``` func (s *Suite) TestClusterControllerSDSDistributed() { } ``` **Note: for SDS/DSDS cluster, you will need to add `integration.SkipIf(s.Framework)`, but for GKE you won't** - Set up your test cluster: ``` cluster := clusterApi.NewCluster(uuid.New().String(), s.ProjectID, s.Organization, fleet.Store, clusterConstant.DSDS, // for non gke clusters below fields are ignored s.Location, "", "", uuid.NewString(), 0, s.Banner) s.createCluster(cluster) defer s.deleteCluster(cluster) ``` - Check to see if your `shipment(s)` is/are created: ``` s.checkShipment(cluster) ``` - Check to see if `infra_status` is `READY`: ``` s.checkInfraStatusDatabaseValue(cluster, edgedb.InfraStatusReady) ``` - Check for cluster namespace creation: ``` ns := &corev1.Namespace{} s.Eventually(func() bool { err := s.Client.Get(s.ctx, types.NamespacedName{Name: cluster.Name}, ns) return !errors.IsNotFound(err) }, s.timeout, s.tick, "expected namespace was never created") s.Eventually(func() bool { return checkNSOwnerReference(cluster, ns.GetOwnerReferences()) }, s.timeout, s.tick, "expected namespace owner reference was not found") ``` - Check for `grub` or `grub2 resources` store-credentials plugin: ``` s.checkHashedGrubSecret(cluster) ``` - Check for `IEN host OS user resources` store-credentials plugin: ``` s.checkHashedBreakGlassSecret(cluster) ``` - Verify the cluster you've just created and check if a `DSDS` type created, not a `GKE` type since we're trying to create a dsds one: ``` gkeCluster := &gkeClusterApi.GKECluster{} s.Never(func() bool { err := s.Client.Get(s.ctx, types.NamespacedName{Name: cluster.Name, Namespace: cluster.Name}, gkeCluster) return !errors.IsNotFound(err) }, time.Second, 100*time.Millisecond, "GKECluster should not exits for non-gke clusters") ``` # If you have any further question, please reach out to the platform team via #ncr-edge-api or #ncr-edge-backend :)