mirror of https://github.com/kubernetes/kops.git
tests: add tests for kubectl get assets
This commit is contained in:
parent
3fde56bb8e
commit
826a778f58
|
@ -75,6 +75,8 @@ type integrationTest struct {
|
||||||
nthRebalance bool
|
nthRebalance bool
|
||||||
// enable GCE startup script
|
// enable GCE startup script
|
||||||
startupScript bool
|
startupScript bool
|
||||||
|
// verify "kops get assets" functionality
|
||||||
|
testGetAssets bool
|
||||||
}
|
}
|
||||||
|
|
||||||
func newIntegrationTest(clusterName, srcDir string) *integrationTest {
|
func newIntegrationTest(clusterName, srcDir string) *integrationTest {
|
||||||
|
@ -89,6 +91,11 @@ func newIntegrationTest(clusterName, srcDir string) *integrationTest {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func (i *integrationTest) withTestGetAssets() *integrationTest {
|
||||||
|
i.testGetAssets = true
|
||||||
|
return i
|
||||||
|
}
|
||||||
|
|
||||||
func (i *integrationTest) withStartupScript() *integrationTest {
|
func (i *integrationTest) withStartupScript() *integrationTest {
|
||||||
i.startupScript = true
|
i.startupScript = true
|
||||||
return i
|
return i
|
||||||
|
@ -1041,6 +1048,7 @@ func TestContainerd(t *testing.T) {
|
||||||
dnsControllerAddon,
|
dnsControllerAddon,
|
||||||
awsCCMAddon,
|
awsCCMAddon,
|
||||||
).
|
).
|
||||||
|
withTestGetAssets().
|
||||||
runTestTerraformAWS(t)
|
runTestTerraformAWS(t)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1319,6 +1327,22 @@ func (i *integrationTest) runTest(t *testing.T, ctx context.Context, h *testutil
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if i.testGetAssets {
|
||||||
|
options := &GetAssetsOptions{}
|
||||||
|
options.GetOptions = &GetOptions{}
|
||||||
|
options.Output = "yaml"
|
||||||
|
options.ClusterName = i.clusterName
|
||||||
|
|
||||||
|
var assetsOut bytes.Buffer
|
||||||
|
err := RunGetAssets(ctx, factory, &assetsOut, options)
|
||||||
|
if err != nil {
|
||||||
|
t.Fatalf("error running get assets %q: %v", i.clusterName, err)
|
||||||
|
}
|
||||||
|
|
||||||
|
wantPath := filepath.Join(i.srcDir, "assets.yaml")
|
||||||
|
golden.AssertMatchesFile(t, assetsOut.String(), wantPath)
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
func (i *integrationTest) setupCluster(t *testing.T, ctx context.Context, inputYAML string, stdout bytes.Buffer) *util.Factory {
|
func (i *integrationTest) setupCluster(t *testing.T, ctx context.Context, inputYAML string, stdout bytes.Buffer) *util.Factory {
|
||||||
|
|
|
@ -0,0 +1,47 @@
|
||||||
|
images:
|
||||||
|
- canonical: registry.k8s.io/kube-apiserver:v1.32.0
|
||||||
|
download: registry.k8s.io/kube-apiserver:v1.32.0
|
||||||
|
- canonical: registry.k8s.io/pause:3.9
|
||||||
|
download: registry.k8s.io/pause:3.9
|
||||||
|
- canonical: registry.k8s.io/kube-controller-manager:v1.32.0
|
||||||
|
download: registry.k8s.io/kube-controller-manager:v1.32.0
|
||||||
|
- canonical: registry.k8s.io/kube-scheduler:v1.32.0
|
||||||
|
download: registry.k8s.io/kube-scheduler:v1.32.0
|
||||||
|
- canonical: registry.k8s.io/kube-proxy:v1.32.0
|
||||||
|
download: registry.k8s.io/kube-proxy:v1.32.0
|
||||||
|
- canonical: registry.k8s.io/kops/kops-controller:1.32.0-beta.1
|
||||||
|
download: registry.k8s.io/kops/kops-controller:1.32.0-beta.1
|
||||||
|
- canonical: registry.k8s.io/coredns/coredns:v1.11.3
|
||||||
|
download: registry.k8s.io/coredns/coredns:v1.11.3
|
||||||
|
- canonical: registry.k8s.io/cpa/cluster-proportional-autoscaler:v1.8.9
|
||||||
|
download: registry.k8s.io/cpa/cluster-proportional-autoscaler:v1.8.9
|
||||||
|
- canonical: registry.k8s.io/kops/dns-controller:1.32.0-beta.1
|
||||||
|
download: registry.k8s.io/kops/dns-controller:1.32.0-beta.1
|
||||||
|
- canonical: public.ecr.aws/aws-ec2/aws-node-termination-handler:v1.22.0
|
||||||
|
download: public.ecr.aws/aws-ec2/aws-node-termination-handler:v1.22.0
|
||||||
|
- canonical: registry.k8s.io/provider-aws/cloud-controller-manager:v1.31.0
|
||||||
|
download: registry.k8s.io/provider-aws/cloud-controller-manager:v1.31.0
|
||||||
|
- canonical: public.ecr.aws/ebs-csi-driver/aws-ebs-csi-driver:v1.38.1
|
||||||
|
download: public.ecr.aws/ebs-csi-driver/aws-ebs-csi-driver:v1.38.1
|
||||||
|
- canonical: public.ecr.aws/eks-distro/kubernetes-csi/node-driver-registrar:v2.12.0-eks-1-32-1
|
||||||
|
download: public.ecr.aws/eks-distro/kubernetes-csi/node-driver-registrar:v2.12.0-eks-1-32-1
|
||||||
|
- canonical: public.ecr.aws/eks-distro/kubernetes-csi/livenessprobe:v2.14.0-eks-1-32-1
|
||||||
|
download: public.ecr.aws/eks-distro/kubernetes-csi/livenessprobe:v2.14.0-eks-1-32-1
|
||||||
|
- canonical: public.ecr.aws/eks-distro/kubernetes-csi/external-provisioner:v5.1.0-eks-1-32-1
|
||||||
|
download: public.ecr.aws/eks-distro/kubernetes-csi/external-provisioner:v5.1.0-eks-1-32-1
|
||||||
|
- canonical: public.ecr.aws/eks-distro/kubernetes-csi/external-attacher:v4.7.0-eks-1-32-1
|
||||||
|
download: public.ecr.aws/eks-distro/kubernetes-csi/external-attacher:v4.7.0-eks-1-32-1
|
||||||
|
- canonical: public.ecr.aws/ebs-csi-driver/volume-modifier-for-k8s:v0.5.0
|
||||||
|
download: public.ecr.aws/ebs-csi-driver/volume-modifier-for-k8s:v0.5.0
|
||||||
|
- canonical: public.ecr.aws/eks-distro/kubernetes-csi/external-resizer:v1.12.0-eks-1-32-1
|
||||||
|
download: public.ecr.aws/eks-distro/kubernetes-csi/external-resizer:v1.12.0-eks-1-32-1
|
||||||
|
- canonical: registry.k8s.io/kops/kube-apiserver-healthcheck:1.32.0-beta.1
|
||||||
|
download: registry.k8s.io/kops/kube-apiserver-healthcheck:1.32.0-beta.1
|
||||||
|
- canonical: registry.k8s.io/kops/kops-utils-cp:1.32.0-beta.1
|
||||||
|
download: registry.k8s.io/kops/kops-utils-cp:1.32.0-beta.1
|
||||||
|
- canonical: registry.k8s.io/etcd:3.4.13-0
|
||||||
|
download: registry.k8s.io/etcd:3.4.13-0
|
||||||
|
- canonical: registry.k8s.io/etcd:3.5.21-0
|
||||||
|
download: registry.k8s.io/etcd:3.5.21-0
|
||||||
|
- canonical: registry.k8s.io/etcd-manager/etcd-manager-slim:v3.0.20241012
|
||||||
|
download: registry.k8s.io/etcd-manager/etcd-manager-slim:v3.0.20241012
|
Loading…
Reference in New Issue