chore: update common test dependencies (#949)
This commit is contained in:
@@ -41,14 +41,14 @@ func (suite *ContainerTestSuite) TestCommand() {
|
||||
|
||||
deploymentManifest := suite.Chart.Manifests.Get("Deployment", "common-test")
|
||||
suite.Assertions.NotEmpty(deploymentManifest)
|
||||
containers, _ := deploymentManifest.Path("spec.template.spec.containers").Children()
|
||||
containers := deploymentManifest.Path("spec.template.spec.containers").Children()
|
||||
containerCommand := containers[0].Path("command")
|
||||
|
||||
if tc.expectedCommand == nil {
|
||||
suite.Assertions.Empty(containerCommand)
|
||||
} else {
|
||||
var actualDataList []string
|
||||
actualData, _ := containerCommand.Children()
|
||||
actualData := containerCommand.Children()
|
||||
for _, key := range actualData {
|
||||
actualDataList = append(actualDataList, key.Data().(string))
|
||||
}
|
||||
@@ -76,14 +76,14 @@ func (suite *ContainerTestSuite) TestArgs() {
|
||||
|
||||
deploymentManifest := suite.Chart.Manifests.Get("Deployment", "common-test")
|
||||
suite.Assertions.NotEmpty(deploymentManifest)
|
||||
containers, _ := deploymentManifest.Path("spec.template.spec.containers").Children()
|
||||
containers := deploymentManifest.Path("spec.template.spec.containers").Children()
|
||||
containerArgs := containers[0].Path("args")
|
||||
|
||||
if tc.expectedArgs == nil {
|
||||
suite.Assertions.Empty(containerArgs)
|
||||
} else {
|
||||
var actualDataList []string
|
||||
actualData, _ := containerArgs.Children()
|
||||
actualData := containerArgs.Children()
|
||||
for _, key := range actualData {
|
||||
actualDataList = append(actualDataList, key.Data().(string))
|
||||
}
|
||||
@@ -130,16 +130,16 @@ func (suite *ContainerTestSuite) TestEnv() {
|
||||
|
||||
deploymentManifest := suite.Chart.Manifests.Get("Deployment", "common-test")
|
||||
suite.Assertions.NotEmpty(deploymentManifest)
|
||||
containers, _ := deploymentManifest.Path("spec.template.spec.containers").Children()
|
||||
containers := deploymentManifest.Path("spec.template.spec.containers").Children()
|
||||
containerEnv := containers[0].Path("env")
|
||||
|
||||
if tc.expectedEnv == nil {
|
||||
suite.Assertions.Empty(containerEnv)
|
||||
} else {
|
||||
actualDataMap := make(map[string]string)
|
||||
actualData, _ := containerEnv.Children()
|
||||
actualData := containerEnv.Children()
|
||||
for _, value := range actualData {
|
||||
envVar, _ := value.ChildrenMap()
|
||||
envVar := value.ChildrenMap()
|
||||
envName := envVar["name"].Data().(string)
|
||||
var envValue string
|
||||
if _, ok := envVar["valueFrom"]; ok {
|
||||
@@ -181,8 +181,8 @@ func (suite *ContainerTestSuite) TestEnvFrom() {
|
||||
deploymentManifest := suite.Chart.Manifests.Get("Deployment", "common-test")
|
||||
suite.Assertions.NotEmpty(deploymentManifest)
|
||||
|
||||
containers, _ := deploymentManifest.Path("spec.template.spec.containers").Children()
|
||||
containerEnvFrom, _ := containers[0].Path("envFrom").Children()
|
||||
containers := deploymentManifest.Path("spec.template.spec.containers").Children()
|
||||
containerEnvFrom := containers[0].Path("envFrom").Children()
|
||||
|
||||
if !tc.expectSecret {
|
||||
suite.Assertions.Empty(containerEnvFrom)
|
||||
@@ -215,8 +215,8 @@ func (suite *ContainerTestSuite) TestPorts() {
|
||||
|
||||
deploymentManifest := suite.Chart.Manifests.Get("Deployment", "common-test")
|
||||
suite.Assertions.NotEmpty(deploymentManifest)
|
||||
containers, _ := deploymentManifest.Path("spec.template.spec.containers").Children()
|
||||
containerPorts, _ := containers[0].Path("ports").Children()
|
||||
containers := deploymentManifest.Path("spec.template.spec.containers").Children()
|
||||
containerPorts := containers[0].Path("ports").Children()
|
||||
suite.Assertions.NotEmpty(containerPorts[0])
|
||||
suite.Assertions.EqualValues(tc.expectedPortName, containerPorts[0].Path("name").Data())
|
||||
suite.Assertions.EqualValues(tc.expectedProtocol, containerPorts[0].Path("protocol").Data())
|
||||
@@ -280,8 +280,8 @@ func (suite *ContainerTestSuite) TestPersistenceVolumeMounts() {
|
||||
|
||||
deploymentManifest := suite.Chart.Manifests.Get("Deployment", "common-test")
|
||||
suite.Assertions.NotEmpty(deploymentManifest)
|
||||
containers, _ := deploymentManifest.Path("spec.template.spec.containers").Children()
|
||||
containerVolumeMounts, _ := containers[0].Path("volumeMounts").Children()
|
||||
containers := deploymentManifest.Path("spec.template.spec.containers").Children()
|
||||
containerVolumeMounts := containers[0].Path("volumeMounts").Children()
|
||||
suite.Assertions.NotEmpty(containerVolumeMounts)
|
||||
|
||||
for _, volumeMount := range containerVolumeMounts {
|
||||
|
||||
@@ -94,7 +94,7 @@ func (suite *HorizontalPodAutoscalerTestSuite) TestMetrics() {
|
||||
manifest := suite.Chart.Manifests.Get("HorizontalPodAutoscaler", "common-test")
|
||||
suite.Assertions.NotEmpty(manifest)
|
||||
|
||||
manifestMetrics, _ := manifest.Path("spec.metrics").Children()
|
||||
manifestMetrics := manifest.Path("spec.metrics").Children()
|
||||
|
||||
metricsMap := make(map[string]int)
|
||||
for _, manifestMetric := range manifestMetrics {
|
||||
|
||||
@@ -85,13 +85,13 @@ func (suite *IngressTestSuite) TestValues() {
|
||||
if tc.expectedIngress {
|
||||
suite.Assertions.NotEmpty(ingressManifest)
|
||||
|
||||
ingressRules, _ := ingressManifest.Path("spec.rules").Children()
|
||||
ingressRules := ingressManifest.Path("spec.rules").Children()
|
||||
if tc.expectedHostName != "" {
|
||||
suite.Assertions.EqualValues(tc.expectedHostName, ingressRules[0].Path("host").Data())
|
||||
}
|
||||
|
||||
if tc.expectedPath != "" {
|
||||
paths, _ := ingressRules[0].Path("http.paths").Children()
|
||||
paths := ingressRules[0].Path("http.paths").Children()
|
||||
suite.Assertions.EqualValues(tc.expectedPath, paths[0].Path("path").Data())
|
||||
}
|
||||
} else {
|
||||
@@ -134,8 +134,8 @@ func (suite *IngressTestSuite) TestPathServices() {
|
||||
ingressManifest := suite.Chart.Manifests.Get("Ingress", "common-test")
|
||||
suite.Assertions.NotEmpty(ingressManifest)
|
||||
|
||||
ingressRules, _ := ingressManifest.Path("spec.rules").Children()
|
||||
paths, _ := ingressRules[0].Path("http.paths").Children()
|
||||
ingressRules := ingressManifest.Path("spec.rules").Children()
|
||||
paths := ingressRules[0].Path("http.paths").Children()
|
||||
primaryPath := paths[0]
|
||||
|
||||
if tc.expectedServiceName == "" {
|
||||
@@ -205,8 +205,8 @@ func (suite *IngressTestSuite) TestTLS() {
|
||||
|
||||
if tc.expectedTLS {
|
||||
suite.Assertions.NotEmpty(ingressManifest.Path("spec.tls").Data())
|
||||
tlsSpec, _ := ingressManifest.Path("spec.tls").Children()
|
||||
tlsHostsSpec, _ := tlsSpec[0].Path("hosts").Children()
|
||||
tlsSpec := ingressManifest.Path("spec.tls").Children()
|
||||
tlsHostsSpec := tlsSpec[0].Path("hosts").Children()
|
||||
suite.Assertions.EqualValues(tc.expectedHostName, tlsHostsSpec[0].Data())
|
||||
|
||||
if tc.expectedSecretName == "" {
|
||||
|
||||
@@ -109,7 +109,7 @@ func (suite *PodTestSuite) TestAdditionalContainers() {
|
||||
|
||||
deploymentManifest := suite.Chart.Manifests.Get("Deployment", "common-test")
|
||||
containers := deploymentManifest.Path("spec.template.spec.containers")
|
||||
suite.Assertions.Contains(containers.Search("name").Data(), tc.expectedContainer)
|
||||
suite.Assertions.Contains(containers.Search("*", "name").Data(), tc.expectedContainer)
|
||||
})
|
||||
}
|
||||
}
|
||||
@@ -155,7 +155,7 @@ func (suite *PodTestSuite) TestPersistenceItems() {
|
||||
suite.Assertions.EqualValues(nil, volumes.Data())
|
||||
} else {
|
||||
suite.Assertions.NotEmpty(volumes)
|
||||
searchVolumes := volumes.Search("name").Data()
|
||||
searchVolumes := volumes.Search("*", "name").Data()
|
||||
for _, expectedVolume := range tc.expectedVolumes {
|
||||
suite.Assertions.Contains(searchVolumes, expectedVolume)
|
||||
}
|
||||
@@ -201,7 +201,7 @@ func (suite *PodTestSuite) TestPersistenceClaimNames() {
|
||||
}
|
||||
|
||||
deploymentManifest := suite.Chart.Manifests.Get("Deployment", "common-test")
|
||||
volumes, _ := deploymentManifest.Path("spec.template.spec.volumes").Children()
|
||||
volumes := deploymentManifest.Path("spec.template.spec.volumes").Children()
|
||||
|
||||
for _, volume := range volumes {
|
||||
volumeName := volume.Path("name").Data().(string)
|
||||
@@ -238,7 +238,7 @@ func (suite *PodTestSuite) TestPersistenceEmptyDir() {
|
||||
}
|
||||
|
||||
deploymentManifest := suite.Chart.Manifests.Get("Deployment", "common-test")
|
||||
volumes, _ := deploymentManifest.Path("spec.template.spec.volumes").Children()
|
||||
volumes := deploymentManifest.Path("spec.template.spec.volumes").Children()
|
||||
volume := volumes[0]
|
||||
suite.Assertions.NotEmpty(volume.Data())
|
||||
|
||||
@@ -294,7 +294,7 @@ func (suite *PodTestSuite) TestHostPathVolumes() {
|
||||
suite.Assertions.EqualValues(nil, volumes.Data())
|
||||
} else {
|
||||
suite.Assertions.NotEmpty(volumes)
|
||||
searchVolumes := volumes.Search("name").Data()
|
||||
searchVolumes := volumes.Search("*", "name").Data()
|
||||
for _, expectedVolume := range tc.expectedVolumes {
|
||||
suite.Assertions.Contains(searchVolumes, expectedVolume)
|
||||
}
|
||||
@@ -330,7 +330,7 @@ func (suite *PodTestSuite) TestVolumeClaimTemplates() {
|
||||
controllerManifest := suite.Chart.Manifests.Get("StatefulSet", "common-test")
|
||||
suite.Assertions.NotEmpty(controllerManifest)
|
||||
|
||||
volumeClaimTemplates, _ := controllerManifest.Path("spec.volumeClaimTemplates").Children()
|
||||
volumeClaimTemplates := controllerManifest.Path("spec.volumeClaimTemplates").Children()
|
||||
suite.Assertions.NotEmpty(volumeClaimTemplates)
|
||||
|
||||
for _, volumeClaimTemplate := range volumeClaimTemplates {
|
||||
@@ -339,7 +339,7 @@ func (suite *PodTestSuite) TestVolumeClaimTemplates() {
|
||||
if tc.expectedAccessMode == "" {
|
||||
suite.Assertions.Empty(controllerManifest)
|
||||
} else {
|
||||
accessModes, _ := volumeClaimTemplate.Path("spec.accessModes").Children()
|
||||
accessModes := volumeClaimTemplate.Path("spec.accessModes").Children()
|
||||
suite.Assertions.EqualValues(tc.expectedAccessMode, accessModes[0].Data())
|
||||
}
|
||||
|
||||
|
||||
@@ -69,7 +69,7 @@ func (suite *ServiceTestSuite) TestPortNames() {
|
||||
|
||||
serviceManifest := suite.Chart.Manifests.Get("Service", "common-test")
|
||||
suite.Assertions.NotEmpty(serviceManifest)
|
||||
servicePorts, _ := serviceManifest.Path("spec.ports").Children()
|
||||
servicePorts := serviceManifest.Path("spec.ports").Children()
|
||||
suite.Assertions.EqualValues(tc.expectedName, servicePorts[0].Path("name").Data())
|
||||
suite.Assertions.EqualValues(tc.expectedTargetPort, servicePorts[0].Path("targetPort").Data())
|
||||
})
|
||||
@@ -96,7 +96,7 @@ func (suite *ServiceTestSuite) TestPortProtocol() {
|
||||
|
||||
serviceManifest := suite.Chart.Manifests.Get("Service", "common-test")
|
||||
suite.Assertions.NotEmpty(serviceManifest)
|
||||
servicePorts, _ := serviceManifest.Path("spec.ports").Children()
|
||||
servicePorts := serviceManifest.Path("spec.ports").Children()
|
||||
suite.Assertions.EqualValues(tc.expectedProtocol, servicePorts[0].Path("protocol").Data())
|
||||
})
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user