Fix the rest of the code
This commit is contained in:
@@ -39,7 +39,7 @@ func rs(name string, replicas int, selector map[string]string) *exp.ReplicaSet {
|
||||
Name: name,
|
||||
},
|
||||
Spec: exp.ReplicaSetSpec{
|
||||
Replicas: replicas,
|
||||
Replicas: int32(replicas),
|
||||
Selector: &unversioned.LabelSelector{MatchLabels: selector},
|
||||
Template: api.PodTemplateSpec{},
|
||||
},
|
||||
@@ -49,7 +49,7 @@ func rs(name string, replicas int, selector map[string]string) *exp.ReplicaSet {
|
||||
func newRSWithStatus(name string, specReplicas, statusReplicas int, selector map[string]string) *exp.ReplicaSet {
|
||||
rs := rs(name, specReplicas, selector)
|
||||
rs.Status = exp.ReplicaSetStatus{
|
||||
Replicas: statusReplicas,
|
||||
Replicas: int32(statusReplicas),
|
||||
}
|
||||
return rs
|
||||
}
|
||||
@@ -60,7 +60,7 @@ func deployment(name string, replicas int, maxSurge, maxUnavailable intstr.IntOr
|
||||
Name: name,
|
||||
},
|
||||
Spec: exp.DeploymentSpec{
|
||||
Replicas: replicas,
|
||||
Replicas: int32(replicas),
|
||||
Strategy: exp.DeploymentStrategy{
|
||||
Type: exp.RollingUpdateDeploymentStrategyType,
|
||||
RollingUpdate: &exp.RollingUpdateDeployment{
|
||||
@@ -75,6 +75,11 @@ func deployment(name string, replicas int, maxSurge, maxUnavailable intstr.IntOr
|
||||
var alwaysReady = func() bool { return true }
|
||||
|
||||
func newDeployment(replicas int, revisionHistoryLimit *int) *exp.Deployment {
|
||||
var v *int32
|
||||
if revisionHistoryLimit != nil {
|
||||
v = new(int32)
|
||||
*v = int32(*revisionHistoryLimit)
|
||||
}
|
||||
d := exp.Deployment{
|
||||
TypeMeta: unversioned.TypeMeta{APIVersion: testapi.Default.GroupVersion().String()},
|
||||
ObjectMeta: api.ObjectMeta{
|
||||
@@ -88,7 +93,7 @@ func newDeployment(replicas int, revisionHistoryLimit *int) *exp.Deployment {
|
||||
Type: exp.RollingUpdateDeploymentStrategyType,
|
||||
RollingUpdate: &exp.RollingUpdateDeployment{},
|
||||
},
|
||||
Replicas: replicas,
|
||||
Replicas: int32(replicas),
|
||||
Selector: &unversioned.LabelSelector{MatchLabels: map[string]string{"foo": "bar"}},
|
||||
Template: api.PodTemplateSpec{
|
||||
ObjectMeta: api.ObjectMeta{
|
||||
@@ -105,7 +110,7 @@ func newDeployment(replicas int, revisionHistoryLimit *int) *exp.Deployment {
|
||||
},
|
||||
},
|
||||
},
|
||||
RevisionHistoryLimit: revisionHistoryLimit,
|
||||
RevisionHistoryLimit: v,
|
||||
},
|
||||
}
|
||||
return &d
|
||||
@@ -118,7 +123,7 @@ func newReplicaSet(d *exp.Deployment, name string, replicas int) *exp.ReplicaSet
|
||||
Namespace: api.NamespaceDefault,
|
||||
},
|
||||
Spec: exp.ReplicaSetSpec{
|
||||
Replicas: replicas,
|
||||
Replicas: int32(replicas),
|
||||
Template: d.Spec.Template,
|
||||
},
|
||||
}
|
||||
@@ -211,7 +216,7 @@ func TestDeploymentController_reconcileNewReplicaSet(t *testing.T) {
|
||||
continue
|
||||
}
|
||||
updated := fake.Actions()[0].(core.UpdateAction).GetObject().(*exp.ReplicaSet)
|
||||
if e, a := test.expectedNewReplicas, updated.Spec.Replicas; e != a {
|
||||
if e, a := test.expectedNewReplicas, int(updated.Spec.Replicas); e != a {
|
||||
t.Errorf("expected update to %d replicas, got %d", e, a)
|
||||
}
|
||||
}
|
||||
@@ -470,12 +475,12 @@ func TestDeploymentController_cleanupUnhealthyReplicas(t *testing.T) {
|
||||
client: &fakeClientset,
|
||||
eventRecorder: &record.FakeRecorder{},
|
||||
}
|
||||
_, cleanupCount, err := controller.cleanupUnhealthyReplicas(oldRSs, &deployment, test.maxCleanupCount)
|
||||
_, cleanupCount, err := controller.cleanupUnhealthyReplicas(oldRSs, &deployment, int32(test.maxCleanupCount))
|
||||
if err != nil {
|
||||
t.Errorf("unexpected error: %v", err)
|
||||
continue
|
||||
}
|
||||
if cleanupCount != test.cleanupCountExpected {
|
||||
if int(cleanupCount) != test.cleanupCountExpected {
|
||||
t.Errorf("expected %v unhealthy replicas been cleaned up, got %v", test.cleanupCountExpected, cleanupCount)
|
||||
continue
|
||||
}
|
||||
@@ -598,7 +603,7 @@ func TestDeploymentController_scaleDownOldReplicaSetsForRollingUpdate(t *testing
|
||||
continue
|
||||
}
|
||||
updated := updateAction.GetObject().(*exp.ReplicaSet)
|
||||
if e, a := test.expectedOldReplicas, updated.Spec.Replicas; e != a {
|
||||
if e, a := test.expectedOldReplicas, int(updated.Spec.Replicas); e != a {
|
||||
t.Errorf("expected update to %d replicas, got %d", e, a)
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user