Added subsystem test for host registration during installation
@@ -238,6 +238,36 @@ var _ = Describe("cluster install", func() {
clusterID = *cluster.ID
registerHostsAndSetRoles(clusterID, 4)
})
+ Context("register hosts", func() {
+ It("register host while installing", func() {
+ _, err := bmclient.Installer.InstallCluster(ctx, &installer.InstallClusterParams{ClusterID: clusterID})
+ Expect(err).NotTo(HaveOccurred())
+ rep, err := bmclient.Installer.GetCluster(ctx, &installer.GetClusterParams{ClusterID: clusterID})
+ Expect(err).NotTo(HaveOccurred())
+ c := rep.GetPayload()
+ Expect(swag.StringValue(c.Status)).Should(Equal("installing"))
+ _, err = bmclient.Installer.RegisterHost(context.Background(), &installer.RegisterHostParams{
+ ClusterID: clusterID,
+ NewHostParams: &models.HostCreateParams{
+ HostID: strToUUID(uuid.New().String()),
+ },
+ })
+ Expect(err).To(BeAssignableToTypeOf(installer.NewRegisterHostForbidden()))
+ })
+
+ It("register host while cluster in error state", func() {
+ FailMasterNode(ctx, clusterID)
+ //Wait for cluster to get to error state
+ waitForClusterState(ctx, clusterID, models.ClusterStatusError, 20*time.Second)
+ _, err := bmclient.Installer.RegisterHost(context.Background(), &installer.RegisterHostParams{
+ ClusterID: clusterID,
+ NewHostParams: &models.HostCreateParams{
+ HostID: strToUUID(uuid.New().String()),
+ },
+ })
+ Expect(err).To(BeAssignableToTypeOf(installer.NewRegisterHostForbidden()))
+ })
+ })
It("install cluster", func() {
_, err := bmclient.Installer.InstallCluster(ctx, &installer.InstallClusterParams{ClusterID: clusterID})
