diff --git a/pkg/controllers/vdb/sandboxsubcluster_reconciler.go b/pkg/controllers/vdb/sandboxsubcluster_reconciler.go index f4b7b8fb9..ba8b99c84 100644 --- a/pkg/controllers/vdb/sandboxsubcluster_reconciler.go +++ b/pkg/controllers/vdb/sandboxsubcluster_reconciler.go @@ -17,7 +17,6 @@ package vdb import ( "context" - "errors" "fmt" "reflect" @@ -159,7 +158,6 @@ func (s *SandboxSubclusterReconciler) sandboxSubclusters(ctx context.Context) (c // executeSandboxCommand will call sandbox API in vclusterOps, create/update sandbox config maps, // and update sandbox status in vdb func (s *SandboxSubclusterReconciler) executeSandboxCommand(ctx context.Context, scSbMap map[string]string) (ctrl.Result, error) { - succeedSbScMap := make(map[string][]string) seenSandboxes := make(map[string]any) // We can simply loop over the scSbMap and sandbox each subcluster. However, @@ -187,22 +185,24 @@ func (s *SandboxSubclusterReconciler) executeSandboxCommand(ctx context.Context, return true, nil }) if err != nil { - return ctrl.Result{}, errors.Join(err, s.updateSandboxStatus(ctx, succeedSbScMap)) + return ctrl.Result{}, err } } res, err := s.sandboxSubcluster(ctx, sc, sb) if verrors.IsReconcileAborted(res, err) { - // when one subcluster failed to be sandboxed, update sandbox status and return error - return res, errors.Join(err, s.updateSandboxStatus(ctx, succeedSbScMap)) + return res, err } - succeedSbScMap[sb] = append(succeedSbScMap[sb], sc) seenSandboxes[sb] = struct{}{} + + // Always update status as we go. When sandboxing two subclusters in + // the same sandbox, the second subcluster depends on the status + // update from the first subcluster in order to properly sandbox. + err = s.addSandboxedSubclusterToStatus(ctx, sc, sb) + if err != nil { + return ctrl.Result{}, err + } } } - err := s.updateSandboxStatus(ctx, succeedSbScMap) - if err != nil { - return ctrl.Result{}, err - } // create/update a sandbox config map for sb := range seenSandboxes { @@ -229,10 +229,12 @@ func (s *SandboxSubclusterReconciler) findInitiatorIPs(ctx context.Context, sand if err := pfs.Collect(ctx, s.Vdb); err != nil { return nil, ctrl.Result{}, err } - // If this is the first pod in the sandbox, then only an API from the + // If this is the first pod in the sandbox, then only an ip from the // main cluster is needed. if len(pfs.Detail) == 0 { - return []string{s.InitiatorIPs[vapi.MainCluster]}, ctrl.Result{}, nil + ips := []string{s.InitiatorIPs[vapi.MainCluster]} + s.Log.Info("detected first subcluster added to a new sandbox", "initiatorIPs", ips) + return ips, ctrl.Result{}, nil } pf, found := pfs.findFirstPodSorted(func(v *PodFact) bool { return v.upNode && v.isPrimary @@ -243,7 +245,9 @@ func (s *SandboxSubclusterReconciler) findInitiatorIPs(ctx context.Context, sand } s.InitiatorIPs[sandbox] = pf.podIP } - return []string{s.InitiatorIPs[vapi.MainCluster], s.InitiatorIPs[sandbox]}, ctrl.Result{}, nil + ips := []string{s.InitiatorIPs[vapi.MainCluster], s.InitiatorIPs[sandbox]} + s.Log.Info("found two initiator IPs", "main", ips[0], "sandbox", ips[1]) + return ips, ctrl.Result{}, nil } // checkSandboxConfigMap will create or update a sandbox config map if needed @@ -378,7 +382,8 @@ func (s *SandboxSubclusterReconciler) sandboxSubcluster(ctx context.Context, sub return ctrl.Result{}, nil } -// updateSandboxStatus will update sandbox status in vdb +// updateSandboxStatus will update sandbox status in vdb. This is a bulk update +// and can handle multiple subclusters at once. func (s *SandboxSubclusterReconciler) updateSandboxStatus(ctx context.Context, originalSbScMap map[string][]string) error { updateStatus := func(vdbChg *vapi.VerticaDB) error { // make a copy of originalSbScMap since we will modify the map, and @@ -408,3 +413,23 @@ func (s *SandboxSubclusterReconciler) updateSandboxStatus(ctx context.Context, o return vdbstatus.Update(ctx, s.Client, s.Vdb, updateStatus) } + +// addSandboxedSubclusterToStatus will add a single subcluster to the sandbox status. +func (s *SandboxSubclusterReconciler) addSandboxedSubclusterToStatus(ctx context.Context, subcluster, sandbox string) error { + updateStatus := func(vdbChg *vapi.VerticaDB) error { + // for existing sandboxes, update their subclusters in sandbox status + for i := range vdbChg.Status.Sandboxes { + if vdbChg.Status.Sandboxes[i].Name == sandbox { + vdbChg.Status.Sandboxes[i].Subclusters = append(vdbChg.Status.Sandboxes[i].Subclusters, subcluster) + return nil + } + } + + // If we get here, we didn't find the sandbox. So we are sandboxing the + // first subcluster in a sandbox. + newStatus := vapi.SandboxStatus{Name: sandbox, Subclusters: []string{subcluster}} + vdbChg.Status.Sandboxes = append(vdbChg.Status.Sandboxes, newStatus) + return nil + } + return vdbstatus.Update(ctx, s.Client, s.Vdb, updateStatus) +} diff --git a/tests/e2e-leg-9/sandbox-on-create/05-create-secrets.yaml b/tests/e2e-leg-9/sandbox-on-create/05-create-secrets.yaml new file mode 100644 index 000000000..ecced2c12 --- /dev/null +++ b/tests/e2e-leg-9/sandbox-on-create/05-create-secrets.yaml @@ -0,0 +1,19 @@ +# (c) Copyright [2021-2024] Open Text. +# Licensed under the Apache License, Version 2.0 (the "License"); +# You may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +apiVersion: kuttl.dev/v1beta1 +kind: TestStep +commands: + - script: kustomize build ../../manifests/communal-creds/overlay | kubectl apply -f - --namespace $NAMESPACE + - script: kustomize build ../../manifests/priv-container-creds/overlay | kubectl apply -f - --namespace $NAMESPACE + - script: kustomize build ../../manifests/vertica-license/overlay | kubectl apply -f - --namespace $NAMESPACE diff --git a/tests/e2e-leg-9/sandbox-on-create/10-assert.yaml b/tests/e2e-leg-9/sandbox-on-create/10-assert.yaml new file mode 100644 index 000000000..9faca75c9 --- /dev/null +++ b/tests/e2e-leg-9/sandbox-on-create/10-assert.yaml @@ -0,0 +1,21 @@ +# (c) Copyright [2021-2024] Open Text. +# Licensed under the Apache License, Version 2.0 (the "License"); +# You may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +apiVersion: v1 +kind: Pod +metadata: + namespace: verticadb-operator + labels: + control-plane: verticadb-operator +status: + phase: Running diff --git a/tests/e2e-leg-9/sandbox-on-create/10-verify-operator.yaml b/tests/e2e-leg-9/sandbox-on-create/10-verify-operator.yaml new file mode 100644 index 000000000..0cd372046 --- /dev/null +++ b/tests/e2e-leg-9/sandbox-on-create/10-verify-operator.yaml @@ -0,0 +1,12 @@ +# (c) Copyright [2021-2024] Open Text. +# Licensed under the Apache License, Version 2.0 (the "License"); +# You may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. diff --git a/tests/e2e-leg-9/sandbox-on-create/15-assert.yaml b/tests/e2e-leg-9/sandbox-on-create/15-assert.yaml new file mode 100644 index 000000000..7e4f0c500 --- /dev/null +++ b/tests/e2e-leg-9/sandbox-on-create/15-assert.yaml @@ -0,0 +1,38 @@ +# (c) Copyright [2021-2024] Open Text. +# Licensed under the Apache License, Version 2.0 (the "License"); +# You may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +apiVersion: apps/v1 +kind: StatefulSet +metadata: + name: v-sandbox-on-create-pri1 +status: + currentReplicas: 3 +--- +apiVersion: apps/v1 +kind: StatefulSet +metadata: + name: v-sandbox-on-create-sec1 +status: + currentReplicas: 1 +--- +apiVersion: apps/v1 +kind: StatefulSet +metadata: + name: v-sandbox-on-create-sec2 +status: + currentReplicas: 1 +--- +apiVersion: vertica.com/v1 +kind: VerticaDB +metadata: + name: v-sandbox-on-create diff --git a/tests/e2e-leg-9/sandbox-on-create/15-setup-vdb.yaml b/tests/e2e-leg-9/sandbox-on-create/15-setup-vdb.yaml new file mode 100644 index 000000000..c9ed69089 --- /dev/null +++ b/tests/e2e-leg-9/sandbox-on-create/15-setup-vdb.yaml @@ -0,0 +1,17 @@ +# (c) Copyright [2021-2024] Open Text. +# Licensed under the Apache License, Version 2.0 (the "License"); +# You may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +apiVersion: kuttl.dev/v1beta1 +kind: TestStep +commands: + - command: bash -c "kustomize build setup-vdb/overlay | kubectl -n $NAMESPACE apply -f - " diff --git a/tests/e2e-leg-9/sandbox-on-create/20-assert.yaml b/tests/e2e-leg-9/sandbox-on-create/20-assert.yaml new file mode 100644 index 000000000..d5bbd7c05 --- /dev/null +++ b/tests/e2e-leg-9/sandbox-on-create/20-assert.yaml @@ -0,0 +1,67 @@ +# (c) Copyright [2021-2024] Open Text. +# Licensed under the Apache License, Version 2.0 (the "License"); +# You may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +apiVersion: kuttl.dev/v1beta1 +kind: TestAssert +timeout: 900 # 15 minutes since this step can be quite long +--- +apiVersion: apps/v1 +kind: StatefulSet +metadata: + name: v-sandbox-on-create-pri1 +status: + currentReplicas: 3 + readyReplicas: 3 +--- +apiVersion: apps/v1 +kind: StatefulSet +metadata: + name: v-sandbox-on-create-sec1 +status: + currentReplicas: 1 + readyReplicas: 1 +--- +apiVersion: apps/v1 +kind: StatefulSet +metadata: + name: v-sandbox-on-create-sec2 +status: + currentReplicas: 1 + readyReplicas: 1 +--- +apiVersion: v1 +kind: ConfigMap +metadata: + name: v-sandbox-on-create-sand1 +data: + sandboxName: sand1 + verticaDBName: v-sandbox-on-create +immutable: true +--- +apiVersion: vertica.com/v1 +kind: VerticaDB +metadata: + name: v-sandbox-on-create +status: + sandboxes: + - name: sand1 + subclusters: + - sec1 + - sec2 + subclusters: + - addedToDBCount: 3 + upNodeCount: 3 + - addedToDBCount: 1 + upNodeCount: 1 + - addedToDBCount: 1 + upNodeCount: 1 diff --git a/tests/e2e-leg-9/sandbox-on-create/20-wait-for-createdb.yaml b/tests/e2e-leg-9/sandbox-on-create/20-wait-for-createdb.yaml new file mode 100644 index 000000000..bf3726035 --- /dev/null +++ b/tests/e2e-leg-9/sandbox-on-create/20-wait-for-createdb.yaml @@ -0,0 +1 @@ +# Intentionally empty to give this step a name in kuttl \ No newline at end of file diff --git a/tests/e2e-leg-9/sandbox-on-create/25-wait-for-steady-state.yaml b/tests/e2e-leg-9/sandbox-on-create/25-wait-for-steady-state.yaml new file mode 100644 index 000000000..7cd771cbb --- /dev/null +++ b/tests/e2e-leg-9/sandbox-on-create/25-wait-for-steady-state.yaml @@ -0,0 +1,17 @@ +# (c) Copyright [2021-2024] Open Text. +# Licensed under the Apache License, Version 2.0 (the "License"); +# You may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +apiVersion: kuttl.dev/v1beta1 +kind: TestStep +commands: + - command: bash -c "../../../scripts/wait-for-verticadb-steady-state.sh -n verticadb-operator -t 360 $NAMESPACE" diff --git a/tests/e2e-leg-9/sandbox-on-create/95-delete-cr.yaml b/tests/e2e-leg-9/sandbox-on-create/95-delete-cr.yaml new file mode 100644 index 000000000..96d43c1de --- /dev/null +++ b/tests/e2e-leg-9/sandbox-on-create/95-delete-cr.yaml @@ -0,0 +1,18 @@ +# (c) Copyright [2021-2024] Open Text. +# Licensed under the Apache License, Version 2.0 (the "License"); +# You may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +apiVersion: kuttl.dev/v1beta1 +kind: TestStep +delete: + - apiVersion: vertica.com/v1 + kind: VerticaDB diff --git a/tests/e2e-leg-9/sandbox-on-create/95-errors.yaml b/tests/e2e-leg-9/sandbox-on-create/95-errors.yaml new file mode 100644 index 000000000..0de5ac42e --- /dev/null +++ b/tests/e2e-leg-9/sandbox-on-create/95-errors.yaml @@ -0,0 +1,24 @@ +# (c) Copyright [2021-2024] Open Text. +# Licensed under the Apache License, Version 2.0 (the "License"); +# You may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +apiVersion: apps/v1 +kind: StatefulSet +--- +apiVersion: v1 +kind: Service +metadata: + labels: + app.kubernetes.io/managed-by: verticadb-operator +--- +apiVersion: vertica.com/v1 +kind: VerticaDB diff --git a/tests/e2e-leg-9/sandbox-on-create/96-assert.yaml b/tests/e2e-leg-9/sandbox-on-create/96-assert.yaml new file mode 100644 index 000000000..861c7dc8f --- /dev/null +++ b/tests/e2e-leg-9/sandbox-on-create/96-assert.yaml @@ -0,0 +1,19 @@ +# (c) Copyright [2021-2024] Open Text. +# Licensed under the Apache License, Version 2.0 (the "License"); +# You may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +apiVersion: v1 +kind: Pod +metadata: + name: clean-communal +status: + phase: Succeeded diff --git a/tests/e2e-leg-9/sandbox-on-create/96-cleanup-storage.yaml b/tests/e2e-leg-9/sandbox-on-create/96-cleanup-storage.yaml new file mode 100644 index 000000000..dcc6306f3 --- /dev/null +++ b/tests/e2e-leg-9/sandbox-on-create/96-cleanup-storage.yaml @@ -0,0 +1,17 @@ +# (c) Copyright [2021-2024] Open Text. +# Licensed under the Apache License, Version 2.0 (the "License"); +# You may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +apiVersion: kuttl.dev/v1beta1 +kind: TestStep +commands: + - command: bash -c "kustomize build clean-communal/overlay | kubectl -n $NAMESPACE apply -f - " diff --git a/tests/e2e-leg-9/sandbox-on-create/96-errors.yaml b/tests/e2e-leg-9/sandbox-on-create/96-errors.yaml new file mode 100644 index 000000000..671be36cf --- /dev/null +++ b/tests/e2e-leg-9/sandbox-on-create/96-errors.yaml @@ -0,0 +1,15 @@ +# (c) Copyright [2021-2024] Open Text. +# Licensed under the Apache License, Version 2.0 (the "License"); +# You may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +apiVersion: v1 +kind: PersistentVolumeClaim diff --git a/tests/e2e-leg-9/sandbox-on-create/99-delete-ns.yaml b/tests/e2e-leg-9/sandbox-on-create/99-delete-ns.yaml new file mode 100644 index 000000000..1674b3e8f --- /dev/null +++ b/tests/e2e-leg-9/sandbox-on-create/99-delete-ns.yaml @@ -0,0 +1,17 @@ +# (c) Copyright [2021-2024] Open Text. +# Licensed under the Apache License, Version 2.0 (the "License"); +# You may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +apiVersion: kuttl.dev/v1beta1 +kind: TestStep +commands: + - command: kubectl delete ns $NAMESPACE diff --git a/tests/e2e-leg-9/sandbox-on-create/setup-vdb/base/kustomization.yaml b/tests/e2e-leg-9/sandbox-on-create/setup-vdb/base/kustomization.yaml new file mode 100644 index 000000000..681396735 --- /dev/null +++ b/tests/e2e-leg-9/sandbox-on-create/setup-vdb/base/kustomization.yaml @@ -0,0 +1,15 @@ +# (c) Copyright [2021-2024] Open Text. +# Licensed under the Apache License, Version 2.0 (the "License"); +# You may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +resources: + - setup-vdb.yaml diff --git a/tests/e2e-leg-9/sandbox-on-create/setup-vdb/base/setup-vdb.yaml b/tests/e2e-leg-9/sandbox-on-create/setup-vdb/base/setup-vdb.yaml new file mode 100644 index 000000000..8f8720972 --- /dev/null +++ b/tests/e2e-leg-9/sandbox-on-create/setup-vdb/base/setup-vdb.yaml @@ -0,0 +1,45 @@ +# (c) Copyright [2021-2024] Open Text. +# Licensed under the Apache License, Version 2.0 (the "License"); +# You may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +apiVersion: vertica.com/v1 +kind: VerticaDB +metadata: + name: v-sandbox-on-create + annotations: + vertica.com/include-uid-in-path: true +spec: + image: kustomize-vertica-image + dbName: sandbox_db + initPolicy: CreateSkipPackageInstall + communal: {} + local: + requestSize: 250Mi + subclusters: + - name: pri1 + size: 3 + type: primary + - name: sec1 + size: 1 + type: secondary + - name: sec2 + size: 1 + type: secondary + sandboxes: + - name: sand1 + subclusters: + - name: sec1 + - name: sec2 + certSecrets: [] + imagePullSecrets: [] + volumes: [] + volumeMounts: [] diff --git a/tests/e2e-leg-9/verify-vrep/09-create-data-users-tlsconfig.yaml b/tests/e2e-leg-9/verify-vrep/09-create-data-users-tlsconfig.yaml index 21b00023d..4be87ed4a 100644 --- a/tests/e2e-leg-9/verify-vrep/09-create-data-users-tlsconfig.yaml +++ b/tests/e2e-leg-9/verify-vrep/09-create-data-users-tlsconfig.yaml @@ -61,7 +61,7 @@ data: echo "Assertion failed: expected 99, got $result" exit 1 fi - result=$(kubectl exec $POD_NAME -i -c server -- bash -c "vsql -U dbadmin -w superuser -tAc \"SELECT COUNT(*) FROM tables;\"") + result=$(kubectl exec $POD_NAME -i -c server -- bash -c "vsql -U dbadmin -w superuser -tAc \"SELECT COUNT(*) FROM tables WHERE table_name = 'test_table';\"") echo "$result" | grep -Pzo "^1\n$" > /dev/null if [ $? -ne 0 ]; then echo "Assertion failed: expected 1, got $result" @@ -73,7 +73,7 @@ data: for POD_NAME in "${POD_NAMES[@]}"; do kubectl exec $POD_NAME -i -c server -- bash -c "vsql -U dbadmin -tAc \"CREATE USER custom_user_with_password IDENTIFIED BY 'topsecret'; GRANT PSEUDOSUPERUSER TO custom_user_with_password; ALTER USER custom_user_with_password DEFAULT ROLE PSEUDOSUPERUSER;\"" kubectl exec $POD_NAME -i -c server -- bash -c "vsql -U dbadmin -tAc \"CREATE USER custom_user; GRANT PSEUDOSUPERUSER TO custom_user; ALTER USER custom_user DEFAULT ROLE PSEUDOSUPERUSER;\"" - result=$(kubectl exec $POD_NAME -i -c server -- bash -c "vsql -U dbadmin -tAc \"SELECT COUNT(*) FROM tables;\"") + result=$(kubectl exec $POD_NAME -i -c server -- bash -c "vsql -U dbadmin -tAc \"SELECT COUNT(*) FROM tables WHERE table_name = 'test_table';\"") echo "$result" | grep -Pzo "^0\n$" > /dev/null if [ $? -ne 0 ]; then echo "Assertion failed: expected 0, got $result" diff --git a/tests/e2e-leg-9/verify-vrep/20-verify-target-data.yaml b/tests/e2e-leg-9/verify-vrep/20-verify-target-data.yaml index 6827dc11f..d52685811 100644 --- a/tests/e2e-leg-9/verify-vrep/20-verify-target-data.yaml +++ b/tests/e2e-leg-9/verify-vrep/20-verify-target-data.yaml @@ -24,7 +24,7 @@ data: POD_NAMES=("v-target-sc5-0" "v-target-sc4-0" "v-target-sc3-0" "v-target-sc2-0") for POD_NAME in "${POD_NAMES[@]}"; do - result=$(kubectl exec $POD_NAME -i -c server -- bash -c "vsql -U dbadmin -tAc \"SELECT COUNT(*) FROM tables;\"") + result=$(kubectl exec $POD_NAME -i -c server -- bash -c "vsql -U dbadmin -tAc \"SELECT COUNT(*) FROM tables WHERE table_name = 'test_table';\"") echo "$result" | grep -Pzo "^0\n$" > /dev/null if [ $? -ne 0 ]; then echo "Assertion failed: expected 0, got $result" @@ -41,7 +41,7 @@ data: echo "Assertion failed: expected 99, got $result" exit 1 fi - result=$(kubectl exec $POD_NAME -i -c server -- bash -c "vsql -U dbadmin -w superuser -tAc \"SELECT COUNT(*) FROM tables;\"") + result=$(kubectl exec $POD_NAME -i -c server -- bash -c "vsql -U dbadmin -w superuser -tAc \"SELECT COUNT(*) FROM tables WHERE table_name = 'test_table';\"") echo "$result" | grep -Pzo "^1\n$" > /dev/null if [ $? -ne 0 ]; then echo "Assertion failed: expected 1, got $result" diff --git a/tests/e2e-leg-9/verify-vrep/35-verify-target-sandbox-data.yaml b/tests/e2e-leg-9/verify-vrep/35-verify-target-sandbox-data.yaml index 1a254b9a8..c40989ff6 100644 --- a/tests/e2e-leg-9/verify-vrep/35-verify-target-sandbox-data.yaml +++ b/tests/e2e-leg-9/verify-vrep/35-verify-target-sandbox-data.yaml @@ -24,7 +24,7 @@ data: POD_NAMES=("v-target-sc5-0" "v-target-sc4-0" "v-target-sc3-0") for POD_NAME in "${POD_NAMES[@]}"; do - result=$(kubectl exec $POD_NAME -i -c server -- bash -c "vsql -U dbadmin -tAc \"SELECT COUNT(*) FROM tables;\"") + result=$(kubectl exec $POD_NAME -i -c server -- bash -c "vsql -U dbadmin -tAc \"SELECT COUNT(*) FROM tables WHERE table_name = 'test_table';\"") echo "$result" | grep -Pzo "^0\n$" > /dev/null if [ $? -ne 0 ]; then echo "Assertion failed: expected 0, got $result" @@ -41,7 +41,7 @@ data: echo "Assertion failed: expected 99, got $result" exit 1 fi - result=$(kubectl exec $POD_NAME -i -c server -- bash -c "vsql -U dbadmin -w superuser -tAc \"SELECT COUNT(*) FROM tables;\"") + result=$(kubectl exec $POD_NAME -i -c server -- bash -c "vsql -U dbadmin -w superuser -tAc \"SELECT COUNT(*) FROM tables WHERE table_name = 'test_table';\"") echo "$result" | grep -Pzo "^1\n$" > /dev/null if [ $? -ne 0 ]; then echo "Assertion failed: expected 1, got $result" diff --git a/tests/e2e-leg-9/verify-vrep/50-verify-target-sandbox-data-custom-username.yaml b/tests/e2e-leg-9/verify-vrep/50-verify-target-sandbox-data-custom-username.yaml index b63ad367c..6bb55d3f6 100644 --- a/tests/e2e-leg-9/verify-vrep/50-verify-target-sandbox-data-custom-username.yaml +++ b/tests/e2e-leg-9/verify-vrep/50-verify-target-sandbox-data-custom-username.yaml @@ -24,7 +24,7 @@ data: POD_NAMES=("v-target-sc5-0") for POD_NAME in "${POD_NAMES[@]}"; do - result=$(kubectl exec $POD_NAME -i -c server -- bash -c "vsql -U dbadmin -tAc \"SELECT COUNT(*) FROM tables;\"") + result=$(kubectl exec $POD_NAME -i -c server -- bash -c "vsql -U dbadmin -tAc \"SELECT COUNT(*) FROM tables WHERE table_name = 'test_table';\"") echo "$result" | grep -Pzo "^0\n$" > /dev/null if [ $? -ne 0 ]; then echo "Assertion failed: expected 0, got $result" @@ -41,7 +41,7 @@ data: echo "Assertion failed: expected 99, got $result" exit 1 fi - result=$(kubectl exec $POD_NAME -i -c server -- bash -c "vsql -U dbadmin -w superuser -tAc \"SELECT COUNT(*) FROM tables;\"") + result=$(kubectl exec $POD_NAME -i -c server -- bash -c "vsql -U dbadmin -w superuser -tAc \"SELECT COUNT(*) FROM tables WHERE table_name = 'test_table';\"") echo "$result" | grep -Pzo "^1\n$" > /dev/null if [ $? -ne 0 ]; then echo "Assertion failed: expected 1, got $result" diff --git a/tests/e2e-leg-9/verify-vrep/65-verify-target-sandbox-data-tls-config.yaml b/tests/e2e-leg-9/verify-vrep/65-verify-target-sandbox-data-tls-config.yaml index b7451e739..11716d482 100644 --- a/tests/e2e-leg-9/verify-vrep/65-verify-target-sandbox-data-tls-config.yaml +++ b/tests/e2e-leg-9/verify-vrep/65-verify-target-sandbox-data-tls-config.yaml @@ -30,7 +30,7 @@ data: echo "Assertion failed: expected 99, got $result" exit 1 fi - result=$(kubectl exec $POD_NAME -i -c server -- bash -c "vsql -U dbadmin -w superuser -tAc \"SELECT COUNT(*) FROM tables;\"") + result=$(kubectl exec $POD_NAME -i -c server -- bash -c "vsql -U dbadmin -w superuser -tAc \"SELECT COUNT(*) FROM tables WHERE table_name = 'test_table';\"") echo "$result" | grep -Pzo "^1\n$" > /dev/null if [ $? -ne 0 ]; then echo "Assertion failed: expected 1, got $result" diff --git a/tests/e2e-leg-9/verify-vrep/70-create-target-sandbox-data.yaml b/tests/e2e-leg-9/verify-vrep/70-create-target-sandbox-data.yaml index dd5140149..a74f399eb 100644 --- a/tests/e2e-leg-9/verify-vrep/70-create-target-sandbox-data.yaml +++ b/tests/e2e-leg-9/verify-vrep/70-create-target-sandbox-data.yaml @@ -28,7 +28,7 @@ data: echo "Assertion failed: expected lines containing 99 and 100" exit 1 fi - result=$(kubectl exec $POD_NAME -i -c server -- bash -c "vsql -U dbadmin -tAc \"SELECT COUNT(*) FROM tables;\"") + result=$(kubectl exec $POD_NAME -i -c server -- bash -c "vsql -U dbadmin -tAc \"SELECT COUNT(*) FROM tables WHERE table_name = 'test_table';\"") echo "$result" | grep -Pzo "^1\n$" > /dev/null if [ $? -ne 0 ]; then echo "Assertion failed: expected 1, got $result" @@ -41,7 +41,7 @@ data: echo "Assertion failed: expected 99, got $result" exit 1 fi - result=$(kubectl exec $POD_NAME -i -c server -- bash -c "vsql -U dbadmin -tAc \"SELECT COUNT(*) FROM tables;\"") + result=$(kubectl exec $POD_NAME -i -c server -- bash -c "vsql -U dbadmin -tAc \"SELECT COUNT(*) FROM tables WHERE table_name = 'test_table';\"") echo "$result" | grep -Pzo "^1\n$" > /dev/null if [ $? -ne 0 ]; then echo "Assertion failed: expected 1, got $result" @@ -69,4 +69,4 @@ spec: - name: entrypoint-volume configMap: defaultMode: 0777 - name: script-create-target-sandbox-data \ No newline at end of file + name: script-create-target-sandbox-data diff --git a/tests/e2e-leg-9/verify-vrep/85-verify-target-sandbox-data.yaml b/tests/e2e-leg-9/verify-vrep/85-verify-target-sandbox-data.yaml index b34fe32bd..77275caec 100644 --- a/tests/e2e-leg-9/verify-vrep/85-verify-target-sandbox-data.yaml +++ b/tests/e2e-leg-9/verify-vrep/85-verify-target-sandbox-data.yaml @@ -27,7 +27,7 @@ data: echo "Assertion failed: expected lines containing 99 and 100" exit 1 fi - result=$(kubectl exec $POD_NAME -i -c server -- bash -c "vsql -U dbadmin -tAc \"SELECT COUNT(*) FROM tables;\"") + result=$(kubectl exec $POD_NAME -i -c server -- bash -c "vsql -U dbadmin -tAc \"SELECT COUNT(*) FROM tables WHERE table_name = 'test_table';\"") echo "$result" | grep -Pzo "^1\n$" > /dev/null if [ $? -ne 0 ]; then echo "Assertion failed: expected 1, got $result" @@ -55,4 +55,4 @@ spec: - name: entrypoint-volume configMap: defaultMode: 0777 - name: script-verify-targetdb-sandbox-data \ No newline at end of file + name: script-verify-targetdb-sandbox-data