From 70f6aaea7537d4653e21c9417ea36c0d7a344337 Mon Sep 17 00:00:00 2001 From: David Bloss Date: Mon, 5 Aug 2024 14:33:41 -0500 Subject: [PATCH] update test predicate domain_id test order --- .../filter_predicate_domain_id.tftest.hcl | 92 +++++++++---------- 1 file changed, 46 insertions(+), 46 deletions(-) diff --git a/tests/remote/filter_predicate_domain_id.tftest.hcl b/tests/remote/filter_predicate_domain_id.tftest.hcl index 5e4cfe28..094790e8 100644 --- a/tests/remote/filter_predicate_domain_id.tftest.hcl +++ b/tests/remote/filter_predicate_domain_id.tftest.hcl @@ -18,7 +18,7 @@ run "get_domain" { } } -run "resource_filter_with_domain_id_predicate_exists" { +run "resource_filter_with_domain_id_predicate_equals" { variables { predicates = tomap({ @@ -26,9 +26,9 @@ run "resource_filter_with_domain_id_predicate_exists" { key = pair[0], type = pair[1], key_data = null, - value = null + value = run.get_domain.first_domain.id } - if contains(var.predicate_types_exists, pair[1]) + if contains(var.predicate_types_equals, pair[1]) }) } @@ -37,60 +37,68 @@ run "resource_filter_with_domain_id_predicate_exists" { } assert { - condition = opslevel_filter.all_predicates["domain_id_does_not_exist"].predicate[0].key == "domain_id" + condition = opslevel_filter.all_predicates["domain_id_does_not_equal"].predicate[0].key == "domain_id" error_message = format( "expected predicate key 'domain_id' got '%s'", - opslevel_filter.all_predicates["domain_id_does_not_exist"].predicate[0].key + opslevel_filter.all_predicates["domain_id_does_not_equal"].predicate[0].key ) } assert { - condition = opslevel_filter.all_predicates["domain_id_does_not_exist"].predicate[0].type == "does_not_exist" + condition = opslevel_filter.all_predicates["domain_id_does_not_equal"].predicate[0].type == "does_not_equal" error_message = format( - "expected predicate type 'does_not_exist' got '%s'", - opslevel_filter.all_predicates["domain_id_does_not_exist"].predicate[0].type + "expected predicate type 'does_not_equal' got '%s'", + opslevel_filter.all_predicates["domain_id_does_not_equal"].predicate[0].type ) } assert { - condition = opslevel_filter.all_predicates["domain_id_does_not_exist"].predicate[0].key_data == null + condition = opslevel_filter.all_predicates["domain_id_does_not_equal"].predicate[0].key_data == null error_message = var.error_expected_null_field } assert { - condition = opslevel_filter.all_predicates["domain_id_does_not_exist"].predicate[0].value == null - error_message = var.error_expected_null_field + condition = opslevel_filter.all_predicates["domain_id_does_not_equal"].predicate[0].value == run.get_domain.first_domain.id + error_message = format( + "expected predicate value '%s' got '%s'", + run.get_domain.first_domain.id, + opslevel_filter.all_predicates["domain_id_does_not_equal"].predicate[0].value + ) } assert { - condition = opslevel_filter.all_predicates["domain_id_exists"].predicate[0].key == "domain_id" + condition = opslevel_filter.all_predicates["domain_id_equals"].predicate[0].key == "domain_id" error_message = format( "expected predicate key 'domain_id' got '%s'", - opslevel_filter.all_predicates["domain_id_exists"].predicate[0].key + opslevel_filter.all_predicates["domain_id_equals"].predicate[0].key ) } assert { - condition = opslevel_filter.all_predicates["domain_id_exists"].predicate[0].type == "exists" + condition = opslevel_filter.all_predicates["domain_id_equals"].predicate[0].type == "equals" error_message = format( - "expected predicate type 'exists' got '%s'", - opslevel_filter.all_predicates["domain_id_exists"].predicate[0].type + "expected predicate type 'equals' got '%s'", + opslevel_filter.all_predicates["domain_id_equals"].predicate[0].type ) } assert { - condition = opslevel_filter.all_predicates["domain_id_exists"].predicate[0].key_data == null + condition = opslevel_filter.all_predicates["domain_id_equals"].predicate[0].key_data == null error_message = var.error_expected_null_field } assert { - condition = opslevel_filter.all_predicates["domain_id_exists"].predicate[0].value == null - error_message = var.error_expected_null_field + condition = opslevel_filter.all_predicates["domain_id_equals"].predicate[0].value == run.get_domain.first_domain.id + error_message = format( + "expected predicate value '%s' got '%s'", + run.get_domain.first_domain.id, + opslevel_filter.all_predicates["domain_id_equals"].predicate[0].type + ) } } -run "resource_filter_with_domain_id_predicate_equals" { +run "resource_filter_with_domain_id_predicate_exists" { variables { predicates = tomap({ @@ -98,9 +106,9 @@ run "resource_filter_with_domain_id_predicate_equals" { key = pair[0], type = pair[1], key_data = null, - value = run.get_domain.first_domain.id + value = null } - if contains(var.predicate_types_equals, pair[1]) + if contains(var.predicate_types_exists, pair[1]) }) } @@ -109,63 +117,55 @@ run "resource_filter_with_domain_id_predicate_equals" { } assert { - condition = opslevel_filter.all_predicates["domain_id_does_not_equal"].predicate[0].key == "domain_id" + condition = opslevel_filter.all_predicates["domain_id_does_not_exist"].predicate[0].key == "domain_id" error_message = format( "expected predicate key 'domain_id' got '%s'", - opslevel_filter.all_predicates["domain_id_does_not_equal"].predicate[0].key + opslevel_filter.all_predicates["domain_id_does_not_exist"].predicate[0].key ) } assert { - condition = opslevel_filter.all_predicates["domain_id_does_not_equal"].predicate[0].type == "does_not_equal" + condition = opslevel_filter.all_predicates["domain_id_does_not_exist"].predicate[0].type == "does_not_exist" error_message = format( - "expected predicate type 'does_not_equal' got '%s'", - opslevel_filter.all_predicates["domain_id_does_not_equal"].predicate[0].type + "expected predicate type 'does_not_exist' got '%s'", + opslevel_filter.all_predicates["domain_id_does_not_exist"].predicate[0].type ) } assert { - condition = opslevel_filter.all_predicates["domain_id_does_not_equal"].predicate[0].key_data == null + condition = opslevel_filter.all_predicates["domain_id_does_not_exist"].predicate[0].key_data == null error_message = var.error_expected_null_field } assert { - condition = opslevel_filter.all_predicates["domain_id_does_not_equal"].predicate[0].value == run.get_domain.first_domain.id - error_message = format( - "expected predicate value '%s' got '%s'", - run.get_domain.first_domain.id, - opslevel_filter.all_predicates["domain_id_does_not_equal"].predicate[0].value - ) + condition = opslevel_filter.all_predicates["domain_id_does_not_exist"].predicate[0].value == null + error_message = var.error_expected_null_field } assert { - condition = opslevel_filter.all_predicates["domain_id_equals"].predicate[0].key == "domain_id" + condition = opslevel_filter.all_predicates["domain_id_exists"].predicate[0].key == "domain_id" error_message = format( "expected predicate key 'domain_id' got '%s'", - opslevel_filter.all_predicates["domain_id_equals"].predicate[0].key + opslevel_filter.all_predicates["domain_id_exists"].predicate[0].key ) } assert { - condition = opslevel_filter.all_predicates["domain_id_equals"].predicate[0].type == "equals" + condition = opslevel_filter.all_predicates["domain_id_exists"].predicate[0].type == "exists" error_message = format( - "expected predicate type 'equals' got '%s'", - opslevel_filter.all_predicates["domain_id_equals"].predicate[0].type + "expected predicate type 'exists' got '%s'", + opslevel_filter.all_predicates["domain_id_exists"].predicate[0].type ) } assert { - condition = opslevel_filter.all_predicates["domain_id_equals"].predicate[0].key_data == null + condition = opslevel_filter.all_predicates["domain_id_exists"].predicate[0].key_data == null error_message = var.error_expected_null_field } assert { - condition = opslevel_filter.all_predicates["domain_id_equals"].predicate[0].value == run.get_domain.first_domain.id - error_message = format( - "expected predicate value '%s' got '%s'", - run.get_domain.first_domain.id, - opslevel_filter.all_predicates["domain_id_equals"].predicate[0].type - ) + condition = opslevel_filter.all_predicates["domain_id_exists"].predicate[0].value == null + error_message = var.error_expected_null_field } }