...
|
...
|
@@ -4,12 +4,13 @@ package integration
|
4
|
4
|
|
5
|
5
|
import (
|
6
|
6
|
"testing"
|
|
7
|
+ "time"
|
7
|
8
|
|
8
|
|
- kapi "k8s.io/kubernetes/pkg/api"
|
9
|
|
- "k8s.io/kubernetes/pkg/apis/extensions"
|
|
9
|
+ "k8s.io/kubernetes/pkg/util/wait"
|
10
|
10
|
|
11
|
11
|
deployapi "github.com/openshift/origin/pkg/deploy/api"
|
12
|
12
|
deploytest "github.com/openshift/origin/pkg/deploy/api/test"
|
|
13
|
+ deployutil "github.com/openshift/origin/pkg/deploy/util"
|
13
|
14
|
testutil "github.com/openshift/origin/test/util"
|
14
|
15
|
testserver "github.com/openshift/origin/test/util/server"
|
15
|
16
|
)
|
...
|
...
|
@@ -38,6 +39,17 @@ func TestDeployScale(t *testing.T) {
|
38
|
38
|
t.Fatalf("Couldn't create DeploymentConfig: %v %#v", err, config)
|
39
|
39
|
}
|
40
|
40
|
|
|
41
|
+ condition := func() (bool, error) {
|
|
42
|
+ config, err := osClient.DeploymentConfigs(namespace).Get(dc.Name)
|
|
43
|
+ if err != nil {
|
|
44
|
+ return false, nil
|
|
45
|
+ }
|
|
46
|
+ return deployutil.HasSynced(config), nil
|
|
47
|
+ }
|
|
48
|
+ if err := wait.PollImmediate(500*time.Millisecond, 10*time.Second, condition); err != nil {
|
|
49
|
+ t.Fatalf("Deployment config never synced: %v", err)
|
|
50
|
+ }
|
|
51
|
+
|
41
|
52
|
scale, err := osClient.DeploymentConfigs(namespace).GetScale(config.Name)
|
42
|
53
|
if err != nil {
|
43
|
54
|
t.Fatalf("Couldn't get DeploymentConfig scale: %v", err)
|
...
|
...
|
@@ -46,13 +58,9 @@ func TestDeployScale(t *testing.T) {
|
46
|
46
|
t.Fatalf("Expected scale.spec.replicas=1, got %#v", scale)
|
47
|
47
|
}
|
48
|
48
|
|
49
|
|
- scaleUpdate := &extensions.Scale{
|
50
|
|
- ObjectMeta: kapi.ObjectMeta{
|
51
|
|
- Name: dc.Name,
|
52
|
|
- Namespace: namespace,
|
53
|
|
- },
|
54
|
|
- Spec: extensions.ScaleSpec{Replicas: 3},
|
55
|
|
- }
|
|
49
|
+ scaleUpdate := deployapi.ScaleFromConfig(dc)
|
|
50
|
+ scaleUpdate.Spec.Replicas = 3
|
|
51
|
+
|
56
|
52
|
updatedScale, err := osClient.DeploymentConfigs(namespace).UpdateScale(scaleUpdate)
|
57
|
53
|
if err != nil {
|
58
|
54
|
// If this complains about "Scale" not being registered in "v1", check the kind overrides in the API registration in SubresourceGroupVersionKind
|