Skip to content

Commit

Permalink
Adjust kuttl tests to match StatefulSet instead of Deployment
Browse files Browse the repository at this point in the history
Signed-off-by: Francesco Pantano <[email protected]>
  • Loading branch information
fmount committed Oct 30, 2023
1 parent f940b98 commit fda8e38
Show file tree
Hide file tree
Showing 12 changed files with 12 additions and 48 deletions.
6 changes: 0 additions & 6 deletions api/bases/glance.openstack.org_glances.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -1156,12 +1156,6 @@ spec:
type: array
databaseHostname:
type: string
glanceAPIExternalReadyCount:
format: int32
type: integer
glanceAPIInternalReadyCount:
format: int32
type: integer
hash:
additionalProperties:
type: string
Expand Down
6 changes: 0 additions & 6 deletions api/v1beta1/glance_types.go
Original file line number Diff line number Diff line change
Expand Up @@ -167,12 +167,6 @@ type GlanceStatus struct {

// Glance Database Hostname
DatabaseHostname string `json:"databaseHostname,omitempty"`

// ReadyCount of internal and admin Glance API instance
GlanceAPIInternalReadyCount int32 `json:"glanceAPIInternalReadyCount,omitempty"`

// ReadyCount of external and admin Glance API instance
GlanceAPIExternalReadyCount int32 `json:"glanceAPIExternalReadyCount,omitempty"`
}

//+kubebuilder:object:root=true
Expand Down
6 changes: 0 additions & 6 deletions config/crd/bases/glance.openstack.org_glances.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -1156,12 +1156,6 @@ spec:
type: array
databaseHostname:
type: string
glanceAPIExternalReadyCount:
format: int32
type: integer
glanceAPIInternalReadyCount:
format: int32
type: integer
hash:
additionalProperties:
type: string
Expand Down
6 changes: 2 additions & 4 deletions controllers/glance_controller.go
Original file line number Diff line number Diff line change
Expand Up @@ -610,11 +610,10 @@ func (r *GlanceReconciler) reconcileNormal(ctx context.Context, instance *glance
instance.Status.APIEndpoints = map[string]string{}
}

// Mirror internal GlanceAPI status' APIEndpoints and ReadyCount to this parent CR
// Mirror internal GlanceAPI status' APIEndpoints to this parent CR
if glanceAPI.Status.APIEndpoints != nil {
instance.Status.APIEndpoints = glanceAPI.Status.APIEndpoints
}
instance.Status.GlanceAPIInternalReadyCount = glanceAPI.Status.ReadyCount

// Get internal GlanceAPI's condition status for comparison with external below
internalAPICondition := glanceAPI.Status.Conditions.Mirror(glancev1.GlanceAPIReadyCondition)
Expand All @@ -635,11 +634,10 @@ func (r *GlanceReconciler) reconcileNormal(ctx context.Context, instance *glance
r.Log.Info(fmt.Sprintf("Deployment %s successfully reconciled - operation: %s", instance.Name, string(op)))
}

// Mirror external GlanceAPI status' APIEndpoints and ReadyCount to this parent CR
// Mirror external GlanceAPI status' APIEndpoints to this parent CR
if glanceAPI.Status.APIEndpoints != nil {
instance.Status.APIEndpoints[string(endpoint.EndpointPublic)] = glanceAPI.Status.APIEndpoints[string(endpoint.EndpointPublic)]
}
instance.Status.GlanceAPIExternalReadyCount = glanceAPI.Status.ReadyCount

// Get external GlanceAPI's condition status and compare it against priority of internal GlanceAPI's condition
externalAPICondition := glanceAPI.Status.Conditions.Mirror(glancev1.GlanceAPIReadyCondition)
Expand Down
File renamed without changes.
2 changes: 0 additions & 2 deletions test/functional/glance_controller_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -39,8 +39,6 @@ var _ = Describe("Glance controller", func() {
g.Expect(glance.Status.Conditions).To(HaveLen(12))
g.Expect(glance.Status.DatabaseHostname).To(Equal(""))
g.Expect(glance.Status.APIEndpoints).To(BeEmpty())
g.Expect(glance.Status.GlanceAPIExternalReadyCount).To(Equal(int32(0)))
g.Expect(glance.Status.GlanceAPIInternalReadyCount).To(Equal(int32(0)))
}, timeout, interval).Should(Succeed())
})
It("reports InputReady False as secret is not found", func() {
Expand Down
2 changes: 0 additions & 2 deletions test/functional/sample_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -64,8 +64,6 @@ var _ = Describe("Samples", func() {
g.Expect(glance.Status.Conditions).To(HaveLen(12))
g.Expect(glance.Status.DatabaseHostname).To(Equal(""))
g.Expect(glance.Status.APIEndpoints).To(BeEmpty())
g.Expect(glance.Status.GlanceAPIExternalReadyCount).To(Equal(int32(0)))
g.Expect(glance.Status.GlanceAPIInternalReadyCount).To(Equal(int32(0)))
}, timeout, interval).Should(Succeed())
})
})
Expand Down
10 changes: 2 additions & 8 deletions test/kuttl/tests/glance_scale/01-assert.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -37,8 +37,6 @@ spec:
storageRequest: 10G
status:
databaseHostname: openstack
glanceAPIExternalReadyCount: 1
glanceAPIInternalReadyCount: 1
---
apiVersion: glance.openstack.org/v1beta1
kind: GlanceAPI
Expand All @@ -55,8 +53,6 @@ spec:
database: GlanceDatabasePassword
service: GlancePassword
replicas: 1
status:
readyCount: 1
---
apiVersion: glance.openstack.org/v1beta1
kind: GlanceAPI
Expand All @@ -73,11 +69,9 @@ spec:
database: GlanceDatabasePassword
service: GlancePassword
replicas: 1
status:
readyCount: 1
---
apiVersion: apps/v1
kind: Deployment
kind: StatefulSet
metadata:
name: glance-external-api
spec:
Expand Down Expand Up @@ -119,7 +113,7 @@ status:
replicas: 1
---
apiVersion: apps/v1
kind: Deployment
kind: StatefulSet
metadata:
name: glance-internal-api
spec:
Expand Down
7 changes: 2 additions & 5 deletions test/kuttl/tests/glance_scale/02-assert.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -14,12 +14,9 @@ spec:
replicas: 2
glanceAPIExternal:
replicas: 2
status:
glanceAPIExternalReadyCount: 2
glanceAPIInternalReadyCount: 2
---
apiVersion: apps/v1
kind: Deployment
kind: StatefulSet
metadata:
name: glance-external-api
spec:
Expand All @@ -29,7 +26,7 @@ status:
replicas: 2
---
apiVersion: apps/v1
kind: Deployment
kind: StatefulSet
metadata:
name: glance-internal-api
spec:
Expand Down
7 changes: 2 additions & 5 deletions test/kuttl/tests/glance_scale/03-assert.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -14,12 +14,9 @@ spec:
replicas: 1
glanceAPIExternal:
replicas: 1
status:
glanceAPIExternalReadyCount: 1
glanceAPIInternalReadyCount: 1
---
apiVersion: apps/v1
kind: Deployment
kind: StatefulSet
metadata:
name: glance-external-api
spec:
Expand All @@ -29,7 +26,7 @@ status:
replicas: 1
---
apiVersion: apps/v1
kind: Deployment
kind: StatefulSet
metadata:
name: glance-internal-api
spec:
Expand Down
4 changes: 2 additions & 2 deletions test/kuttl/tests/glance_scale/04-assert.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -16,14 +16,14 @@ spec:
replicas: 0
---
apiVersion: apps/v1
kind: Deployment
kind: StatefulSet
metadata:
name: glance-external-api
spec:
replicas: 0
---
apiVersion: apps/v1
kind: Deployment
kind: StatefulSet
metadata:
name: glance-internal-api
spec:
Expand Down
4 changes: 2 additions & 2 deletions test/kuttl/tests/glance_scale/05-errors.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -27,12 +27,12 @@ metadata:
name: glance-internal
---
apiVersion: apps/v1
kind: Deployment
kind: StatefulSet
metadata:
name: glance-external-api
---
apiVersion: apps/v1
kind: Deployment
kind: StatefulSet
metadata:
name: glance-internal-api
---
Expand Down

0 comments on commit fda8e38

Please sign in to comment.