Skip to content

Commit

Permalink
ISSUE-651 add basic unit tests
Browse files Browse the repository at this point in the history
  • Loading branch information
maracle6 committed Oct 18, 2023
1 parent 7107d90 commit e63e3b4
Show file tree
Hide file tree
Showing 2 changed files with 74 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -22,9 +22,9 @@ ingress:

# List one deployment for each patch release of Pega Infinity that needs to be supported.
# The path accessed by the user's browser will include the Pega build nnumber (e.g. /8.8.1-161),
# so the load balancer should support a wildcard at the end of the path name.
# so the load balancer should be configured to allow a wildcard at the end of the path name.
deployments:
# - name: "881"
# image: pega-docker.downloads.pega.com/constellationui/cdn-onprem:8.8.1-ga-52
# path: "/8.8.1(.*)"
# replicas: 1
- name: "881"
image: pega-docker.downloads.pega.com/constellationui/cdn-onprem:8.8.1-ga-52
path: "/8.8.1(.*)"
replicas: 1
69 changes: 69 additions & 0 deletions terratest/src/test/backingservices/constellation_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,60 @@ func Test_shouldContainConstellationResourcesWhenEnabled(t *testing.T) {
}
}

func Test_shouldContainConstellationResourcesWithOptionalValues(t *testing.T) {
helmChartParser := NewHelmConfigParser(
NewHelmTest(t, helmChartRelativePath, map[string]string{
"constellation.enabled": "true",
"constellation.customerAssetVolumeClaimName": "claim-name",
"constellation.ingressAnnotations": "annotation",
"constellation.imagePullSecretNames": "{secret1, secret2}",
}),
)

for _, i := range constellationResources {
require.True(t, helmChartParser.Contains(SearchResourceOption{
Name: i.Name,
Kind: i.Kind,
}))
}
}

func Test_shouldContainConstellationCdnWhenEnabled(t *testing.T) {
helmChartParser := NewHelmConfigParser(
NewHelmTest(t, helmChartRelativePath, map[string]string{
"constellation.constellation-cdn.enabled": "true",
"constellation.constellation-cdn.name": "constellation-cdn",
"constellation.constellation-cdn.imagePullSecretNames": "{secret1, secret2}",
"constellation.constellation-cdn.ingress.domain": "test.com",
}),
)

for _, i := range constellationCdnResources {
require.True(t, helmChartParser.Contains(SearchResourceOption{
Name: i.Name,
Kind: i.Kind,
}))
}
}

func Test_shouldNotContainConstellationCdnWhenDisabled(t *testing.T) {
helmChartParser := NewHelmConfigParser(
NewHelmTest(t, helmChartRelativePath, map[string]string{
"constellation.constellation-cdn.enabled": "false",
"constellation.constellation-cdn.name": "constellation-cdn",
"constellation.constellation-cdn.imagePullSecretNames": "{secret1, secret2}",
"constellation.constellation-cdn.ingress.domain": "test.com",
}),
)

for _, i := range constellationCdnResources {
require.False(t, helmChartParser.Contains(SearchResourceOption{
Name: i.Name,
Kind: i.Kind,
}))
}
}

var constellationResources = []SearchResourceOption{
{
Name: "constellation",
Expand All @@ -53,3 +107,18 @@ var constellationResources = []SearchResourceOption{
Kind: "Secret",
},
}

var constellationCdnResources = []SearchResourceOption{
{
Name: "constellation-cdn-881",
Kind: "Deployment",
},
{
Name: "constellation-cdn-881",
Kind: "Service",
},
{
Name: "constellation-cdn",
Kind: "Ingress",
},
}

0 comments on commit e63e3b4

Please sign in to comment.