Promote SS to apps/v1

This commit is contained in:
dhilipkumars
2017-11-15 17:21:34 +05:30
parent ae96999b07
commit aba725a391
36 changed files with 200 additions and 152 deletions

View File

@@ -26,17 +26,14 @@ import (
core "k8s.io/client-go/testing"
"k8s.io/client-go/tools/cache"
apps "k8s.io/api/apps/v1beta1"
apps "k8s.io/api/apps/v1"
"k8s.io/client-go/kubernetes/fake"
appslisters "k8s.io/client-go/listers/apps/v1beta1"
appslisters "k8s.io/client-go/listers/apps/v1"
)
func TestStatefulSetUpdaterUpdatesSetStatus(t *testing.T) {
set := newStatefulSet(3)
status := apps.StatefulSetStatus{ObservedGeneration: func() *int64 {
i := int64(1)
return &i
}(), Replicas: 2}
status := apps.StatefulSetStatus{ObservedGeneration: 1, Replicas: 2}
fakeClient := &fake.Clientset{}
updater := NewRealStatefulSetStatusUpdater(fakeClient, nil)
fakeClient.AddReactor("update", "statefulsets", func(action core.Action) (bool, runtime.Object, error) {
@@ -53,16 +50,13 @@ func TestStatefulSetUpdaterUpdatesSetStatus(t *testing.T) {
func TestStatefulSetStatusUpdaterUpdatesObservedGeneration(t *testing.T) {
set := newStatefulSet(3)
status := apps.StatefulSetStatus{ObservedGeneration: func() *int64 {
i := int64(3)
return &i
}(), Replicas: 2}
status := apps.StatefulSetStatus{ObservedGeneration: 3, Replicas: 2}
fakeClient := &fake.Clientset{}
updater := NewRealStatefulSetStatusUpdater(fakeClient, nil)
fakeClient.AddReactor("update", "statefulsets", func(action core.Action) (bool, runtime.Object, error) {
update := action.(core.UpdateAction)
sts := update.GetObject().(*apps.StatefulSet)
if sts.Status.ObservedGeneration == nil || *sts.Status.ObservedGeneration != int64(3) {
if sts.Status.ObservedGeneration != 3 {
t.Errorf("expected observedGeneration to be synced with generation for statefulset %q", sts.Name)
}
return true, sts, nil
@@ -74,10 +68,7 @@ func TestStatefulSetStatusUpdaterUpdatesObservedGeneration(t *testing.T) {
func TestStatefulSetStatusUpdaterUpdateReplicasFailure(t *testing.T) {
set := newStatefulSet(3)
status := apps.StatefulSetStatus{ObservedGeneration: func() *int64 {
i := int64(3)
return &i
}(), Replicas: 2}
status := apps.StatefulSetStatus{ObservedGeneration: 3, Replicas: 2}
fakeClient := &fake.Clientset{}
indexer := cache.NewIndexer(cache.MetaNamespaceKeyFunc, cache.Indexers{cache.NamespaceIndex: cache.MetaNamespaceIndexFunc})
indexer.Add(set)
@@ -93,10 +84,7 @@ func TestStatefulSetStatusUpdaterUpdateReplicasFailure(t *testing.T) {
func TestStatefulSetStatusUpdaterUpdateReplicasConflict(t *testing.T) {
set := newStatefulSet(3)
status := apps.StatefulSetStatus{ObservedGeneration: func() *int64 {
i := int64(3)
return &i
}(), Replicas: 2}
status := apps.StatefulSetStatus{ObservedGeneration: 3, Replicas: 2}
conflict := false
fakeClient := &fake.Clientset{}
indexer := cache.NewIndexer(cache.MetaNamespaceKeyFunc, cache.Indexers{cache.NamespaceIndex: cache.MetaNamespaceIndexFunc})
@@ -122,10 +110,7 @@ func TestStatefulSetStatusUpdaterUpdateReplicasConflict(t *testing.T) {
func TestStatefulSetStatusUpdaterUpdateReplicasConflictFailure(t *testing.T) {
set := newStatefulSet(3)
status := apps.StatefulSetStatus{ObservedGeneration: func() *int64 {
i := int64(3)
return &i
}(), Replicas: 2}
status := apps.StatefulSetStatus{ObservedGeneration: 3, Replicas: 2}
fakeClient := &fake.Clientset{}
indexer := cache.NewIndexer(cache.MetaNamespaceKeyFunc, cache.Indexers{cache.NamespaceIndex: cache.MetaNamespaceIndexFunc})
indexer.Add(set)