Skip to content

Commit 50142a0

Browse files
committed
feat: remove reference validation
1 parent 02ff20d commit 50142a0

2 files changed

Lines changed: 6 additions & 29 deletions

File tree

stackgres-k8s/e2e/spec/operator-profile-api

Lines changed: 1 addition & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -281,7 +281,6 @@ test_api_delete_profile_is_invible() {
281281
}
282282

283283
test_constraint_violation_api_error() {
284-
285284
PROFILE="$(get_updated_profile 'memory' '""')"
286285

287286
echo "$PROFILE" > "$LOG_PATH/invalid-profile.json"
@@ -304,29 +303,17 @@ test_constraint_violation_api_error() {
304303
EXPECTED_ERROR_FIELD="memory"
305304

306305
assert_api_error "$ERROR_RESPONSE"
307-
308306
}
309307

310308
test_dependency_api_error(){
311-
312309
remove_cluster "$CLUSTER_NAME" "$CLUSTER_NAMESPACE"
313310
create_or_replace_cluster "$CLUSTER_NAME" "$CLUSTER_NAMESPACE" 1
314311

315312
local HTTP_STATUS
316313

317314
HTTP_STATUS="$(run_curl -r "stackgres/sginstanceprofiles" -n "$CLUSTER_NAMESPACE" -d "$LOG_PATH/default-profile.json" -e '-X DELETE -w %{http_code} -o /dev/null')"
318315

319-
assert_string_equal "409" "$HTTP_STATUS"
320-
321-
ERROR_RESPONSE="$(run_curl -r "stackgres/sginstanceprofiles" -n "$CLUSTER_NAMESPACE" -d "$LOG_PATH/default-profile.json" -e '-X DELETE')"
322-
323-
EXPECTED_ERROR_TYPE="forbidden-configuration-deletion"
324-
EXPECTED_ERROR_TITLE="Forbidden configuration deletion"
325-
EXPECTED_ERROR_DETAIL="Can't delete sginstanceprofiles.stackgres.io size-s"
326-
EXPECTED_ERROR_FIELD=""
327-
328-
assert_api_error "$ERROR_RESPONSE"
329-
316+
assert_string_equal "204" "$HTTP_STATUS"
330317
}
331318

332319
test_authentication_api_error() {

stackgres-k8s/e2e/spec/profile-removal

Lines changed: 5 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -15,30 +15,20 @@ e2e_test() {
1515
}
1616

1717
delete_with_cluster() {
18-
if ERROR="$(kubectl delete -n "$CLUSTER_NAMESPACE" sginstanceprofiles.stackgres.io size-s 2>&1)"
18+
if ERROR="$(kubectl delete --dry-run=server -n "$CLUSTER_NAMESPACE" sginstanceprofiles.stackgres.io size-s 2>&1)"
1919
then
20-
echo "INFO: It should not be able to delete size-s"
21-
return 1
20+
success "Good. It can delete the configuration"
2221
else
23-
success "Good it has failed"
24-
fi
25-
26-
if echo "$ERROR" | grep -q "Can't delete sginstanceprofiles.stackgres.io size-s"
27-
then
28-
success "Error message was the expected"
29-
return 0
30-
else
31-
fail "Error is not what it should be. ERROR ${ERROR}"
22+
fail "It should be able to delete the size-s. ERROR ${ERROR}"
3223
fi
3324
}
3425

3526
delete_whitout_cluster(){
3627
kubectl get -n "$CLUSTER_NAMESPACE" sgclusters.stackgres.io "$CLUSTER_NAME" -o yaml | kubectl delete -f -
3728

38-
if ERROR="$(kubectl get -n "$CLUSTER_NAMESPACE" sginstanceprofiles.stackgres.io size-s 2>&1)"
29+
if ERROR="$(kubectl delete --dry-run=server -n "$CLUSTER_NAMESPACE" sginstanceprofiles.stackgres.io size-s 2>&1)"
3930
then
40-
success "Good. It has deleted the configuration"
41-
return 0
31+
success "Good. It can delete the configuration"
4232
else
4333
fail "It should be able to delete the size-s. ERROR ${ERROR}"
4434
fi

0 commit comments

Comments
 (0)