1
1
package test
2
2
3
3
import (
4
- "path/filepath"
5
- "strings"
6
- "testing"
7
-
8
4
"github.com/gruntwork-io/terratest/modules/helm"
9
5
"github.com/gruntwork-io/terratest/modules/k8s"
10
6
"github.com/gruntwork-io/terratest/modules/random"
11
7
"github.com/stretchr/testify/suite"
12
- "gopkg.in/yaml.v3"
8
+ yaml3 "gopkg.in/yaml.v3"
13
9
appv1 "k8s.io/api/apps/v1"
14
10
corev1 "k8s.io/api/core/v1"
11
+ "path/filepath"
12
+ "strings"
13
+ "testing"
15
14
)
16
15
17
16
type PlatformChartTemplateSuite struct {
@@ -513,7 +512,7 @@ func (s *PlatformChartTemplateSuite) Test_Custom_Config_Template_Services_Merged
513
512
helm .UnmarshalK8SYaml (s .T (), output , & cm )
514
513
515
514
var config map [string ]interface {}
516
- s .Require ().NoError (yaml .Unmarshal ([]byte (cm .Data ["opentdf.yaml" ]), & config ))
515
+ s .Require ().NoError (yaml3 .Unmarshal ([]byte (cm .Data ["opentdf.yaml" ]), & config ))
517
516
518
517
s .Require ().Equal (releaseName + "-platform" , cm .Name )
519
518
@@ -530,7 +529,7 @@ func (s *PlatformChartTemplateSuite) Test_Custom_Config_Template_Services_Merged
530
529
s .Require ().True (testServiceKeyFound )
531
530
}
532
531
533
- func (s * PlatformChartTemplateSuite ) Test_TLS_Enabled_Expect_HTTP2_AppProtocol () {
532
+ func (s * PlatformChartTemplateSuite ) Test_TLS_Enabled_Expect_HTTPS_AppProtocol () {
534
533
releaseName := "basic"
535
534
536
535
namespaceName := "opentdf-" + strings .ToLower (random .UniqueId ())
@@ -547,7 +546,18 @@ func (s *PlatformChartTemplateSuite) Test_TLS_Enabled_Expect_HTTP2_AppProtocol()
547
546
helm .UnmarshalK8SYaml (s .T (), output , & svc )
548
547
549
548
for _ , port := range svc .Spec .Ports {
550
- s .Require ().Equal ("http2" , * port .AppProtocol )
549
+ s .Require ().Equal ("https" , * port .AppProtocol )
550
+ }
551
+
552
+ output = helm .RenderTemplate (s .T (), options , s .chartPath , releaseName , []string {"templates/deployment.yaml" })
553
+ var deployment appv1.Deployment
554
+ helm .UnmarshalK8SYaml (s .T (), output , & deployment )
555
+ for _ , container := range deployment .Spec .Template .Spec .Containers {
556
+ for _ , port := range container .Ports {
557
+ s .Require ().Equal ("https" , port .Name )
558
+ }
559
+ s .Require ().Equal ("https" , container .ReadinessProbe .HTTPGet .Port .String ())
560
+ s .Require ().Equal ("https" , container .LivenessProbe .HTTPGet .Port .String ())
551
561
}
552
562
}
553
563
@@ -567,6 +577,17 @@ func (s *PlatformChartTemplateSuite) Test_TLS_Disabled_Generic_K8S_Expect_K8S_H2
567
577
for _ , port := range svc .Spec .Ports {
568
578
s .Require ().Equal ("kubernetes.io/h2c" , * port .AppProtocol )
569
579
}
580
+
581
+ output = helm .RenderTemplate (s .T (), options , s .chartPath , releaseName , []string {"templates/deployment.yaml" })
582
+ var deployment appv1.Deployment
583
+ helm .UnmarshalK8SYaml (s .T (), output , & deployment )
584
+ for _ , container := range deployment .Spec .Template .Spec .Containers {
585
+ for _ , port := range container .Ports {
586
+ s .Require ().Equal ("http2" , port .Name )
587
+ }
588
+ s .Require ().Equal ("http2" , container .ReadinessProbe .HTTPGet .Port .String ())
589
+ s .Require ().Equal ("http2" , container .LivenessProbe .HTTPGet .Port .String ())
590
+ }
570
591
}
571
592
572
593
func (s * PlatformChartTemplateSuite ) Test_TLS_Disabled_Openshift_Expect_H2C_AppProtocol () {
0 commit comments