mirror of
https://github.com/k3s-io/kubernetes.git
synced 2026-01-06 07:57:35 +00:00
move deployment PodTemplate to be not a pointer
This commit is contained in:
@@ -88,6 +88,15 @@ func TestSetDefaultDeployment(t *testing.T) {
|
||||
defaultIntOrString := util.NewIntOrStringFromInt(1)
|
||||
differentIntOrString := util.NewIntOrStringFromInt(5)
|
||||
deploymentLabelKey := "deployment.kubernetes.io/podTemplateHash"
|
||||
period := int64(v1.DefaultTerminationGracePeriodSeconds)
|
||||
defaultTemplate := v1.PodTemplateSpec{
|
||||
Spec: v1.PodSpec{
|
||||
DNSPolicy: v1.DNSClusterFirst,
|
||||
RestartPolicy: v1.RestartPolicyAlways,
|
||||
SecurityContext: &v1.PodSecurityContext{},
|
||||
TerminationGracePeriodSeconds: &period,
|
||||
},
|
||||
}
|
||||
tests := []struct {
|
||||
original *Deployment
|
||||
expected *Deployment
|
||||
@@ -104,6 +113,7 @@ func TestSetDefaultDeployment(t *testing.T) {
|
||||
MaxUnavailable: &defaultIntOrString,
|
||||
},
|
||||
},
|
||||
Template: defaultTemplate,
|
||||
UniqueLabelKey: newString(deploymentLabelKey),
|
||||
},
|
||||
},
|
||||
@@ -129,6 +139,7 @@ func TestSetDefaultDeployment(t *testing.T) {
|
||||
MaxUnavailable: &defaultIntOrString,
|
||||
},
|
||||
},
|
||||
Template: defaultTemplate,
|
||||
UniqueLabelKey: newString(deploymentLabelKey),
|
||||
},
|
||||
},
|
||||
@@ -148,6 +159,7 @@ func TestSetDefaultDeployment(t *testing.T) {
|
||||
Strategy: DeploymentStrategy{
|
||||
Type: RecreateDeploymentStrategyType,
|
||||
},
|
||||
Template: defaultTemplate,
|
||||
UniqueLabelKey: newString(deploymentLabelKey),
|
||||
},
|
||||
},
|
||||
@@ -168,6 +180,7 @@ func TestSetDefaultDeployment(t *testing.T) {
|
||||
Strategy: DeploymentStrategy{
|
||||
Type: RecreateDeploymentStrategyType,
|
||||
},
|
||||
Template: defaultTemplate,
|
||||
UniqueLabelKey: newString("customDeploymentKey"),
|
||||
},
|
||||
},
|
||||
@@ -184,7 +197,7 @@ func TestSetDefaultDeployment(t *testing.T) {
|
||||
t.FailNow()
|
||||
}
|
||||
if !reflect.DeepEqual(got.Spec, expected.Spec) {
|
||||
t.Errorf("got different than expected: %v, %v", got, expected)
|
||||
t.Errorf("got different than expected:\n\t%+v\ngot:\n\t%+v", got.Spec, expected.Spec)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user