-
Notifications
You must be signed in to change notification settings - Fork 140
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
4da3973
commit eda2631
Showing
10 changed files
with
307 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -509,3 +509,35 @@ func (s *restapiDeploymentTemplateTest) TestContainerSetInitContainer() { | |
|
||
s.Require().Contains(podContainers, expectedContainer) | ||
} | ||
func (s *restapiDeploymentTemplateTest) TestSetDnsPolicyAndDnsConfig() { | ||
// given | ||
options := &helm.Options{ | ||
SetValues: map[string]string{ | ||
"webModeler.enabled": "true", | ||
"webModeler.restapi.mail.fromAddress": "[email protected]", | ||
"webModeler.restapi.dnsPolicy": "ClusterFirst", | ||
"webModeler.restapi.dnsConfig.nameservers[0]": "8.8.8.8", | ||
"webModeler.restapi.dnsConfig.searches[0]": "example.com", | ||
}, | ||
KubectlOptions: k8s.NewKubectlOptions("", "", s.namespace), | ||
} | ||
|
||
// when | ||
output := helm.RenderTemplate(s.T(), options, s.chartPath, s.release, s.templates) | ||
var deployment appsv1.Deployment | ||
helm.UnmarshalK8SYaml(s.T(), output, &deployment) | ||
|
||
// then | ||
// Check if dnsPolicy is set | ||
require.NotEmpty(s.T(), deployment.Spec.Template.Spec.DNSPolicy, "dnsPolicy should not be empty") | ||
|
||
// Check if dnsConfig is set | ||
require.NotNil(s.T(), deployment.Spec.Template.Spec.DNSConfig, "dnsConfig should not be nil") | ||
|
||
expectedDNSConfig := &corev1.PodDNSConfig{ | ||
Nameservers: []string{"8.8.8.8"}, | ||
Searches: []string{"example.com"}, | ||
} | ||
|
||
require.Equal(s.T(), expectedDNSConfig, deployment.Spec.Template.Spec.DNSConfig, "dnsConfig should match the expected configuration") | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -220,3 +220,35 @@ func (s *webappDeploymentTemplateTest) TestContainerSetInitContainer() { | |
|
||
s.Require().Contains(podContainers, expectedContainer) | ||
} | ||
func (s *webappDeploymentTemplateTest) TestSetDnsPolicyAndDnsConfig() { | ||
// given | ||
options := &helm.Options{ | ||
SetValues: map[string]string{ | ||
"webModeler.enabled": "true", | ||
"webModeler.restapi.mail.fromAddress": "[email protected]", | ||
"webModeler.webapp.dnsPolicy": "ClusterFirst", | ||
"webModeler.webapp.dnsConfig.nameservers[0]": "8.8.8.8", | ||
"webModeler.webapp.dnsConfig.searches[0]": "example.com", | ||
}, | ||
KubectlOptions: k8s.NewKubectlOptions("", "", s.namespace), | ||
} | ||
|
||
// when | ||
output := helm.RenderTemplate(s.T(), options, s.chartPath, s.release, s.templates) | ||
var deployment appsv1.Deployment | ||
helm.UnmarshalK8SYaml(s.T(), output, &deployment) | ||
|
||
// then | ||
// Check if dnsPolicy is set | ||
require.NotEmpty(s.T(), deployment.Spec.Template.Spec.DNSPolicy, "dnsPolicy should not be empty") | ||
|
||
// Check if dnsConfig is set | ||
require.NotNil(s.T(), deployment.Spec.Template.Spec.DNSConfig, "dnsConfig should not be nil") | ||
|
||
expectedDNSConfig := &corev1.PodDNSConfig{ | ||
Nameservers: []string{"8.8.8.8"}, | ||
Searches: []string{"example.com"}, | ||
} | ||
|
||
require.Equal(s.T(), expectedDNSConfig, deployment.Spec.Template.Spec.DNSConfig, "dnsConfig should match the expected configuration") | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -207,3 +207,35 @@ func (s *websocketsDeploymentTemplateTest) TestContainerSetInitContainer() { | |
|
||
s.Require().Contains(podContainers, expectedContainer) | ||
} | ||
func (s *websocketsDeploymentTemplateTest) TestSetDnsPolicyAndDnsConfig() { | ||
// given | ||
options := &helm.Options{ | ||
SetValues: map[string]string{ | ||
"webModeler.enabled": "true", | ||
"webModeler.restapi.mail.fromAddress": "[email protected]", | ||
"webModeler.websockets.dnsPolicy": "ClusterFirst", | ||
"webModeler.websockets.dnsConfig.nameservers[0]": "8.8.8.8", | ||
"webModeler.websockets.dnsConfig.searches[0]": "example.com", | ||
}, | ||
KubectlOptions: k8s.NewKubectlOptions("", "", s.namespace), | ||
} | ||
|
||
// when | ||
output := helm.RenderTemplate(s.T(), options, s.chartPath, s.release, s.templates) | ||
var deployment appsv1.Deployment | ||
helm.UnmarshalK8SYaml(s.T(), output, &deployment) | ||
|
||
// then | ||
// Check if dnsPolicy is set | ||
require.NotEmpty(s.T(), deployment.Spec.Template.Spec.DNSPolicy, "dnsPolicy should not be empty") | ||
|
||
// Check if dnsConfig is set | ||
require.NotNil(s.T(), deployment.Spec.Template.Spec.DNSConfig, "dnsConfig should not be nil") | ||
|
||
expectedDNSConfig := &corev1.PodDNSConfig{ | ||
Nameservers: []string{"8.8.8.8"}, | ||
Searches: []string{"example.com"}, | ||
} | ||
|
||
require.Equal(s.T(), expectedDNSConfig, deployment.Spec.Template.Spec.DNSConfig, "dnsConfig should match the expected configuration") | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters