|
1 | 1 | package integration
|
2 | 2 |
|
3 | 3 | import (
|
| 4 | + "fmt" |
4 | 5 | "testing"
|
5 | 6 | "time"
|
6 | 7 |
|
7 | 8 | metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
|
| 9 | + "k8s.io/apimachinery/pkg/apis/meta/v1/unstructured" |
8 | 10 | "k8s.io/apimachinery/pkg/util/wait"
|
9 | 11 | extensionsv1beta1 "k8s.io/kubernetes/pkg/apis/extensions/v1beta1"
|
10 | 12 |
|
@@ -49,6 +51,40 @@ func TestDeployScale(t *testing.T) {
|
49 | 51 | }
|
50 | 52 | generation := dc.Generation
|
51 | 53 |
|
| 54 | + { |
| 55 | + // Get scale subresource |
| 56 | + legacyPath := fmt.Sprintf("/oapi/v1/namespaces/%s/deploymentconfigs/%s/scale", dc.Namespace, dc.Name) |
| 57 | + legacyScale := &unstructured.Unstructured{} |
| 58 | + if err := adminAppsClient.AppsClient.RESTClient().Get().AbsPath(legacyPath).Do().Into(legacyScale); err != nil { |
| 59 | + t.Fatal(err) |
| 60 | + } |
| 61 | + // Ensure correct type |
| 62 | + if legacyScale.GetAPIVersion() != "extensions/v1beta1" { |
| 63 | + t.Fatalf("Expected extensions/v1beta1, got %v", legacyScale.GetAPIVersion()) |
| 64 | + } |
| 65 | + // Ensure we can submit the same type back |
| 66 | + if err := adminAppsClient.AppsClient.RESTClient().Put().AbsPath(legacyPath).Body(legacyScale).Do().Error(); err != nil { |
| 67 | + t.Fatal(err) |
| 68 | + } |
| 69 | + } |
| 70 | + |
| 71 | + { |
| 72 | + // Get scale subresource |
| 73 | + scalePath := fmt.Sprintf("/apis/apps.openshift.io/v1/namespaces/%s/deploymentconfigs/%s/scale", dc.Namespace, dc.Name) |
| 74 | + scale := &unstructured.Unstructured{} |
| 75 | + if err := adminAppsClient.AppsClient.RESTClient().Get().AbsPath(scalePath).Do().Into(scale); err != nil { |
| 76 | + t.Fatal(err) |
| 77 | + } |
| 78 | + // Ensure correct type |
| 79 | + if scale.GetAPIVersion() != "extensions/v1beta1" { |
| 80 | + t.Fatalf("Expected extensions/v1beta1, got %v", scale.GetAPIVersion()) |
| 81 | + } |
| 82 | + // Ensure we can submit the same type back |
| 83 | + if err := adminAppsClient.AppsClient.RESTClient().Put().AbsPath(scalePath).Body(scale).Do().Error(); err != nil { |
| 84 | + t.Fatal(err) |
| 85 | + } |
| 86 | + } |
| 87 | + |
52 | 88 | condition := func() (bool, error) {
|
53 | 89 | config, err := adminAppsClient.DeploymentConfigs(namespace).Get(dc.Name, metav1.GetOptions{})
|
54 | 90 | if err != nil {
|
|
0 commit comments