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