@@ -65,6 +65,23 @@ var _ = Describe("e2e vmdistributedcluster", Label("vm", "vmdistributedcluster")
6565
6666 Context ("create" , func () {
6767 It ("should successfully create a VMDistributedCluster with inline VMAgent spec" , func () {
68+ By ("creating a VMCluster" )
69+ vmCluster := & vmv1beta1.VMCluster {
70+ ObjectMeta : metav1.ObjectMeta {
71+ Namespace : namespace ,
72+ Name : "vmcluster-inline-vmauth" ,
73+ },
74+ Spec : vmv1beta1.VMClusterSpec {
75+ RetentionPeriod : "1" ,
76+ VMStorage : & vmv1beta1.VMStorage {
77+ CommonApplicationDeploymentParams : vmv1beta1.CommonApplicationDeploymentParams {
78+ ReplicaCount : ptr.To [int32 ](1 ),
79+ },
80+ },
81+ },
82+ }
83+ createVMClusterAndEnsureOperational (ctx , k8sClient , vmCluster , namespace )
84+
6885 By ("creating a VMDistributedCluster with inline VMAgent spec" )
6986 namespacedName .Name = "distributed-cluster-with-inline-vmagent"
7087 vmAgentName := "inline-vmagent"
@@ -87,26 +104,7 @@ var _ = Describe("e2e vmdistributedcluster", Label("vm", "vmdistributedcluster")
87104 },
88105 VMAuth : vmv1alpha1.VMAuthNameAndSpec {Name : vmAuthName },
89106 Zones : vmv1alpha1.ZoneSpec {VMClusters : []vmv1alpha1.VMClusterRefOrSpec {
90- {
91- Name : "inline-cluster-1" ,
92- Spec : & vmv1beta1.VMClusterSpec {
93- VMStorage : & vmv1beta1.VMStorage {
94- CommonApplicationDeploymentParams : vmv1beta1.CommonApplicationDeploymentParams {
95- ReplicaCount : ptr.To [int32 ](1 ),
96- },
97- },
98- },
99- },
100- {
101- Name : "inline-cluster-2" ,
102- Spec : & vmv1beta1.VMClusterSpec {
103- VMStorage : & vmv1beta1.VMStorage {
104- CommonApplicationDeploymentParams : vmv1beta1.CommonApplicationDeploymentParams {
105- ReplicaCount : ptr.To [int32 ](2 ),
106- },
107- },
108- },
109- },
107+ {Ref : & corev1.LocalObjectReference {Name : vmCluster .Name }},
110108 }},
111109 },
112110 }
@@ -239,13 +237,7 @@ var _ = Describe("e2e vmdistributedcluster", Label("vm", "vmdistributedcluster")
239237 },
240238 },
241239 }
242- DeferCleanup (func () {
243- Expect (finalize .SafeDelete (ctx , k8sClient , vmCluster )).To (Succeed ())
244- })
245- Expect (k8sClient .Create (ctx , vmCluster )).To (Succeed ())
246- Eventually (func () error {
247- return expectObjectStatusOperational (ctx , k8sClient , vmCluster , types.NamespacedName {Name : vmCluster .Name , Namespace : namespace })
248- }, eventualVMDistributedClusterExpandingTimeout ).WithContext (ctx ).Should (Succeed ())
240+ createVMClusterAndEnsureOperational (ctx , k8sClient , vmCluster , namespace )
249241
250242 By ("creating a VMDistributedCluster with inline VMAuth spec" )
251243 inlineVMAuthName := "inline-vmauth-proxy"
@@ -735,42 +727,6 @@ var _ = Describe("e2e vmdistributedcluster", Label("vm", "vmdistributedcluster")
735727 }},
736728 },
737729 }, []vmv1beta1.VMCluster {}),
738- Entry ("with invalid OverrideSpec for VMCluster" , & vmv1alpha1.VMDistributedCluster {
739- ObjectMeta : metav1.ObjectMeta {
740- Namespace : namespace ,
741- Name : "invalid-override-spec" ,
742- },
743- Spec : vmv1alpha1.VMDistributedClusterSpec {
744- VMAgentFlushDeadline : & metav1.Duration {Duration : 1 * time .Second },
745- ZoneUpdatePause : & metav1.Duration {Duration : 1 * time .Second },
746- ReadyDeadline : & metav1.Duration {Duration : 10 * time .Second },
747- VMAgent : vmv1alpha1.VMAgentNameAndSpec {Name : vmAgentName },
748- VMAuth : vmv1alpha1.VMAuthNameAndSpec {Name : vmAuthName },
749- Zones : vmv1alpha1.ZoneSpec {VMClusters : []vmv1alpha1.VMClusterRefOrSpec {
750- {
751- Ref : & corev1.LocalObjectReference {Name : "vmcluster-1" },
752- OverrideSpec : & apiextensionsv1.JSON {
753- Raw : []byte (`{"invalidField": "invalidValue"}` ), // Invalid override spec
754- },
755- },
756- }},
757- },
758- }, []vmv1beta1.VMCluster {
759- {
760- ObjectMeta : metav1.ObjectMeta {
761- Namespace : namespace ,
762- Name : "vmcluster-1" ,
763- },
764- Spec : vmv1beta1.VMClusterSpec {
765- RetentionPeriod : "1" ,
766- VMStorage : & vmv1beta1.VMStorage {
767- CommonApplicationDeploymentParams : vmv1beta1.CommonApplicationDeploymentParams {
768- ReplicaCount : ptr.To [int32 ](1 ),
769- },
770- },
771- },
772- },
773- }),
774730 )
775731 })
776732
0 commit comments