diff --git a/statecheck/expect_known_output_value_at_path_test.go b/statecheck/expect_known_output_value_at_path_test.go index 3fcd64637..018deb31b 100644 --- a/statecheck/expect_known_output_value_at_path_test.go +++ b/statecheck/expect_known_output_value_at_path_test.go @@ -43,7 +43,7 @@ func TestExpectKnownOutputValueAtPath_CheckState_ResourceNotFound(t *testing.T) statecheck.ExpectKnownOutputValueAtPath( "test_resource_two_output", tfjsonpath.New("bool_attribute"), - knownvalue.BoolValueExact(true), + knownvalue.BoolExact(true), ), }, ExpectError: regexp.MustCompile("test_resource_two_output - Output not found in state"), @@ -73,7 +73,7 @@ func TestExpectKnownOutputValueAtPath_CheckState_AttributeValueNull(t *testing.T statecheck.ExpectKnownOutputValueAtPath( "test_resource_one_output", tfjsonpath.New("bool_attribute"), - knownvalue.NullValueExact(), + knownvalue.NullExact(), ), }, }, @@ -104,7 +104,7 @@ func TestExpectKnownOutputValueAtPath_CheckState_Bool(t *testing.T) { statecheck.ExpectKnownOutputValueAtPath( "test_resource_one_output", tfjsonpath.New("bool_attribute"), - knownvalue.BoolValueExact(true), + knownvalue.BoolExact(true), ), }, }, @@ -135,10 +135,10 @@ func TestExpectKnownOutputValueAtPath_CheckState_Bool_KnownValueWrongType(t *tes statecheck.ExpectKnownOutputValueAtPath( "test_resource_one_output", tfjsonpath.New("bool_attribute"), - knownvalue.Float64ValueExact(1.23), + knownvalue.Float64Exact(1.23), ), }, - ExpectError: regexp.MustCompile(`expected json\.Number value for Float64ValueExact check, got: bool`), + ExpectError: regexp.MustCompile(`expected json\.Number value for Float64Exact check, got: bool`), }, }, }) @@ -167,10 +167,10 @@ func TestExpectKnownOutputValueAtPath_CheckState_Bool_KnownValueWrongValue(t *te statecheck.ExpectKnownOutputValueAtPath( "test_resource_one_output", tfjsonpath.New("bool_attribute"), - knownvalue.BoolValueExact(false), + knownvalue.BoolExact(false), ), }, - ExpectError: regexp.MustCompile("expected value false for BoolValueExact check, got: true"), + ExpectError: regexp.MustCompile("expected value false for BoolExact check, got: true"), }, }, }) @@ -199,7 +199,7 @@ func TestExpectKnownOutputValueAtPath_CheckState_Float64(t *testing.T) { statecheck.ExpectKnownOutputValueAtPath( "test_resource_one_output", tfjsonpath.New("float_attribute"), - knownvalue.Float64ValueExact(1.23), + knownvalue.Float64Exact(1.23), ), }, }, @@ -231,10 +231,10 @@ func TestExpectKnownOutputValueAtPath_CheckState_Float64_KnownValueWrongType(t * statecheck.ExpectKnownOutputValueAtPath( "test_resource_one_output", tfjsonpath.New("float_attribute"), - knownvalue.StringValueExact("str"), + knownvalue.StringExact("str"), ), }, - ExpectError: regexp.MustCompile(`expected string value for StringValueExact check, got: json\.Number`), + ExpectError: regexp.MustCompile(`expected string value for StringExact check, got: json\.Number`), }, }, }) @@ -263,10 +263,10 @@ func TestExpectKnownOutputValueAtPath_CheckState_Float64_KnownValueWrongValue(t statecheck.ExpectKnownOutputValueAtPath( "test_resource_one_output", tfjsonpath.New("float_attribute"), - knownvalue.Float64ValueExact(3.21), + knownvalue.Float64Exact(3.21), ), }, - ExpectError: regexp.MustCompile("expected value 3.21 for Float64ValueExact check, got: 1.23"), + ExpectError: regexp.MustCompile("expected value 3.21 for Float64Exact check, got: 1.23"), }, }, }) @@ -295,7 +295,7 @@ func TestExpectKnownOutputValueAtPath_CheckState_Int64(t *testing.T) { statecheck.ExpectKnownOutputValueAtPath( "test_resource_one_output", tfjsonpath.New("int_attribute"), - knownvalue.Int64ValueExact(123), + knownvalue.Int64Exact(123), ), }, }, @@ -326,10 +326,10 @@ func TestExpectKnownOutputValueAtPath_CheckState_Int64_KnownValueWrongValue(t *t statecheck.ExpectKnownOutputValueAtPath( "test_resource_one_output", tfjsonpath.New("int_attribute"), - knownvalue.Int64ValueExact(321), + knownvalue.Int64Exact(321), ), }, - ExpectError: regexp.MustCompile("expected value 321 for Int64ValueExact check, got: 123"), + ExpectError: regexp.MustCompile("expected value 321 for Int64Exact check, got: 123"), }, }, }) @@ -361,9 +361,9 @@ func TestExpectKnownOutputValueAtPath_CheckState_List(t *testing.T) { statecheck.ExpectKnownOutputValueAtPath( "test_resource_one_output", tfjsonpath.New("list_attribute"), - knownvalue.ListValueExact([]knownvalue.Check{ - knownvalue.StringValueExact("value1"), - knownvalue.StringValueExact("value2"), + knownvalue.ListExact([]knownvalue.Check{ + knownvalue.StringExact("value1"), + knownvalue.StringExact("value2"), }), ), }, @@ -398,10 +398,10 @@ func TestExpectKnownOutputValueAtPath_CheckState_List_KnownValueWrongType(t *tes statecheck.ExpectKnownOutputValueAtPath( "test_resource_one_output", tfjsonpath.New("list_attribute"), - knownvalue.MapValueExact(map[string]knownvalue.Check{}), + knownvalue.MapExact(map[string]knownvalue.Check{}), ), }, - ExpectError: regexp.MustCompile(`expected map\[string\]any value for MapValueExact check, got: \[\]interface {}`), + ExpectError: regexp.MustCompile(`expected map\[string\]any value for MapExact check, got: \[\]interface {}`), }, }, }) @@ -433,13 +433,13 @@ func TestExpectKnownOutputValueAtPath_CheckState_List_KnownValueWrongValue(t *te statecheck.ExpectKnownOutputValueAtPath( "test_resource_one_output", tfjsonpath.New("list_attribute"), - knownvalue.ListValueExact([]knownvalue.Check{ - knownvalue.StringValueExact("value3"), - knownvalue.StringValueExact("value4"), + knownvalue.ListExact([]knownvalue.Check{ + knownvalue.StringExact("value3"), + knownvalue.StringExact("value4"), }), ), }, - ExpectError: regexp.MustCompile(`list element index 0: expected value value3 for StringValueExact check, got: value1`), + ExpectError: regexp.MustCompile(`list element index 0: expected value value3 for StringExact check, got: value1`), }, }, }) @@ -471,8 +471,8 @@ func TestExpectKnownOutputValueAtPath_CheckState_ListPartial(t *testing.T) { statecheck.ExpectKnownOutputValueAtPath( "test_resource_one_output", tfjsonpath.New("list_attribute"), - knownvalue.ListValuePartial(map[int]knownvalue.Check{ - 0: knownvalue.StringValueExact("value1"), + knownvalue.ListPartial(map[int]knownvalue.Check{ + 0: knownvalue.StringExact("value1"), }), ), }, @@ -509,12 +509,12 @@ func TestExpectKnownOutputValueAtPath_CheckState_ListPartial_KnownValueWrongValu statecheck.ExpectKnownOutputValueAtPath( "test_resource_one_output", tfjsonpath.New("list_attribute"), - knownvalue.ListValuePartial(map[int]knownvalue.Check{ - 0: knownvalue.StringValueExact("value3"), + knownvalue.ListPartial(map[int]knownvalue.Check{ + 0: knownvalue.StringExact("value3"), }), ), }, - ExpectError: regexp.MustCompile(`list element 0: expected value value3 for StringValueExact check, got: value1`), + ExpectError: regexp.MustCompile(`list element 0: expected value value3 for StringExact check, got: value1`), }, }, }) @@ -546,7 +546,7 @@ func TestExpectKnownOutputValueAtPath_CheckState_ListElements(t *testing.T) { statecheck.ExpectKnownOutputValueAtPath( "test_resource_one_output", tfjsonpath.New("list_attribute"), - knownvalue.ListElementsExact(2), + knownvalue.ListSizeExact(2), ), }, }, @@ -580,10 +580,10 @@ func TestExpectKnownOutputValueAtPath_CheckState_ListElements_WrongNum(t *testin statecheck.ExpectKnownOutputValueAtPath( "test_resource_one_output", tfjsonpath.New("list_attribute"), - knownvalue.ListElementsExact(3), + knownvalue.ListSizeExact(3), ), }, - ExpectError: regexp.MustCompile("expected 3 elements for ListElementsExact check, got 2 elements"), + ExpectError: regexp.MustCompile("expected 3 elements for ListSizeExact check, got 2 elements"), }, }, }) @@ -617,12 +617,12 @@ func TestExpectKnownOutputValueAtPath_CheckState_ListNestedBlock(t *testing.T) { statecheck.ExpectKnownOutputValueAtPath( "test_resource_one_output", tfjsonpath.New("list_nested_block"), - knownvalue.ListValueExact([]knownvalue.Check{ - knownvalue.MapValueExact(map[string]knownvalue.Check{ - "list_nested_block_attribute": knownvalue.StringValueExact("str"), + knownvalue.ListExact([]knownvalue.Check{ + knownvalue.MapExact(map[string]knownvalue.Check{ + "list_nested_block_attribute": knownvalue.StringExact("str"), }), - knownvalue.MapValueExact(map[string]knownvalue.Check{ - "list_nested_block_attribute": knownvalue.StringValueExact("rts"), + knownvalue.MapExact(map[string]knownvalue.Check{ + "list_nested_block_attribute": knownvalue.StringExact("rts"), }), }), ), @@ -660,9 +660,9 @@ func TestExpectKnownOutputValueAtPath_CheckState_ListNestedBlockPartial(t *testi statecheck.ExpectKnownOutputValueAtPath( "test_resource_one_output", tfjsonpath.New("list_nested_block"), - knownvalue.ListValuePartial(map[int]knownvalue.Check{ - 1: knownvalue.MapValueExact(map[string]knownvalue.Check{ - "list_nested_block_attribute": knownvalue.StringValueExact("rts"), + knownvalue.ListPartial(map[int]knownvalue.Check{ + 1: knownvalue.MapExact(map[string]knownvalue.Check{ + "list_nested_block_attribute": knownvalue.StringExact("rts"), }), }), ), @@ -700,7 +700,7 @@ func TestExpectKnownOutputValueAtPath_CheckState_ListNestedBlockElements(t *test statecheck.ExpectKnownOutputValueAtPath( "test_resource_one_output", tfjsonpath.New("list_nested_block"), - knownvalue.ListElementsExact(2), + knownvalue.ListSizeExact(2), ), }, }, @@ -734,9 +734,9 @@ func TestExpectKnownOutputValueAtPath_CheckState_Map(t *testing.T) { statecheck.ExpectKnownOutputValueAtPath( "test_resource_one_output", tfjsonpath.New("map_attribute"), - knownvalue.MapValueExact(map[string]knownvalue.Check{ - "key1": knownvalue.StringValueExact("value1"), - "key2": knownvalue.StringValueExact("value2"), + knownvalue.MapExact(map[string]knownvalue.Check{ + "key1": knownvalue.StringExact("value1"), + "key2": knownvalue.StringExact("value2"), }), ), }, @@ -771,10 +771,10 @@ func TestExpectKnownOutputValueAtPath_CheckState_Map_KnownValueWrongType(t *test statecheck.ExpectKnownOutputValueAtPath( "test_resource_one_output", tfjsonpath.New("map_attribute"), - knownvalue.ListValueExact([]knownvalue.Check{}), + knownvalue.ListExact([]knownvalue.Check{}), ), }, - ExpectError: regexp.MustCompile(`expected \[\]any value for ListValueExact check, got: map\[string\]interface {}`), + ExpectError: regexp.MustCompile(`expected \[\]any value for ListExact check, got: map\[string\]interface {}`), }, }, }) @@ -806,13 +806,13 @@ func TestExpectKnownOutputValueAtPath_CheckState_Map_KnownValueWrongValue(t *tes statecheck.ExpectKnownOutputValueAtPath( "test_resource_one_output", tfjsonpath.New("map_attribute"), - knownvalue.MapValueExact(map[string]knownvalue.Check{ - "key3": knownvalue.StringValueExact("value3"), - "key4": knownvalue.StringValueExact("value4"), + knownvalue.MapExact(map[string]knownvalue.Check{ + "key3": knownvalue.StringExact("value3"), + "key4": knownvalue.StringExact("value4"), }), ), }, - ExpectError: regexp.MustCompile(`missing element key3 for MapValueExact check`), + ExpectError: regexp.MustCompile(`missing element key3 for MapExact check`), }, }, }) @@ -844,8 +844,8 @@ func TestExpectKnownOutputValueAtPath_CheckState_MapPartial(t *testing.T) { statecheck.ExpectKnownOutputValueAtPath( "test_resource_one_output", tfjsonpath.New("map_attribute"), - knownvalue.MapValuePartial(map[string]knownvalue.Check{ - "key1": knownvalue.StringValueExact("value1"), + knownvalue.MapPartial(map[string]knownvalue.Check{ + "key1": knownvalue.StringExact("value1"), }), ), }, @@ -880,12 +880,12 @@ func TestExpectKnownOutputValueAtPath_CheckState_MapPartial_KnownValueWrongValue statecheck.ExpectKnownOutputValueAtPath( "test_resource_one_output", tfjsonpath.New("map_attribute"), - knownvalue.MapValuePartial(map[string]knownvalue.Check{ - "key3": knownvalue.StringValueExact("value1"), + knownvalue.MapPartial(map[string]knownvalue.Check{ + "key3": knownvalue.StringExact("value1"), }), ), }, - ExpectError: regexp.MustCompile(`missing element key3 for MapValuePartial check`), + ExpectError: regexp.MustCompile(`missing element key3 for MapPartial check`), }, }, }) @@ -917,7 +917,7 @@ func TestExpectKnownOutputValueAtPath_CheckState_MapElements(t *testing.T) { statecheck.ExpectKnownOutputValueAtPath( "test_resource_one_output", tfjsonpath.New("map_attribute"), - knownvalue.MapElementsExact(2), + knownvalue.MapSizeExact(2), ), }, }, @@ -951,10 +951,10 @@ func TestExpectKnownOutputValueAtPath_CheckState_MapElements_WrongNum(t *testing statecheck.ExpectKnownOutputValueAtPath( "test_resource_one_output", tfjsonpath.New("map_attribute"), - knownvalue.MapElementsExact(3), + knownvalue.MapSizeExact(3), ), }, - ExpectError: regexp.MustCompile("expected 3 elements for MapElementsExact check, got 2 elements"), + ExpectError: regexp.MustCompile("expected 3 elements for MapSizeExact check, got 2 elements"), }, }, }) @@ -989,7 +989,7 @@ func TestExpectKnownOutputValueAtPath_CheckState_Number(t *testing.T) { statecheck.ExpectKnownOutputValueAtPath( "test_resource_one_output", tfjsonpath.New("int_attribute"), - knownvalue.NumberValueExact(f), + knownvalue.NumberExact(f), ), }, }, @@ -1026,10 +1026,10 @@ func TestExpectKnownOutputValueAtPath_CheckState_Number_KnownValueWrongValue(t * statecheck.ExpectKnownOutputValueAtPath( "test_resource_one_output", tfjsonpath.New("int_attribute"), - knownvalue.NumberValueExact(f), + knownvalue.NumberExact(f), ), }, - ExpectError: regexp.MustCompile("expected value 321 for NumberValueExact check, got: 123"), + ExpectError: regexp.MustCompile("expected value 321 for NumberExact check, got: 123"), }, }, }) @@ -1061,9 +1061,9 @@ func TestExpectKnownOutputValueAtPath_CheckState_Set(t *testing.T) { statecheck.ExpectKnownOutputValueAtPath( "test_resource_one_output", tfjsonpath.New("set_attribute"), - knownvalue.SetValueExact([]knownvalue.Check{ - knownvalue.StringValueExact("value1"), - knownvalue.StringValueExact("value2"), + knownvalue.SetExact([]knownvalue.Check{ + knownvalue.StringExact("value1"), + knownvalue.StringExact("value2"), }), ), }, @@ -1098,13 +1098,13 @@ func TestExpectKnownOutputValueAtPath_CheckState_Set_KnownValueWrongValue(t *tes statecheck.ExpectKnownOutputValueAtPath( "test_resource_one_output", tfjsonpath.New("set_attribute"), - knownvalue.SetValueExact([]knownvalue.Check{ - knownvalue.StringValueExact("value1"), - knownvalue.StringValueExact("value3"), + knownvalue.SetExact([]knownvalue.Check{ + knownvalue.StringExact("value1"), + knownvalue.StringExact("value3"), }), ), }, - ExpectError: regexp.MustCompile(`missing value value3 for SetValueExact check`), + ExpectError: regexp.MustCompile(`missing value value3 for SetExact check`), }, }, }) @@ -1136,8 +1136,8 @@ func TestExpectKnownOutputValueAtPath_CheckState_SetPartial(t *testing.T) { statecheck.ExpectKnownOutputValueAtPath( "test_resource_one_output", tfjsonpath.New("set_attribute"), - knownvalue.SetValuePartial([]knownvalue.Check{ - knownvalue.StringValueExact("value2"), + knownvalue.SetPartial([]knownvalue.Check{ + knownvalue.StringExact("value2"), }), ), }, @@ -1172,12 +1172,12 @@ func TestExpectKnownOutputValueAtPath_CheckState_SetPartial_KnownValueWrongValue statecheck.ExpectKnownOutputValueAtPath( "test_resource_one_output", tfjsonpath.New("set_attribute"), - knownvalue.SetValuePartial([]knownvalue.Check{ - knownvalue.StringValueExact("value3"), + knownvalue.SetPartial([]knownvalue.Check{ + knownvalue.StringExact("value3"), }), ), }, - ExpectError: regexp.MustCompile(`missing value value3 for SetValuePartial check`), + ExpectError: regexp.MustCompile(`missing value value3 for SetPartial check`), }, }, }) @@ -1209,7 +1209,7 @@ func TestExpectKnownOutputValueAtPath_CheckState_SetElements(t *testing.T) { statecheck.ExpectKnownOutputValueAtPath( "test_resource_one_output", tfjsonpath.New("set_attribute"), - knownvalue.SetElementsExact(2), + knownvalue.SetSizeExact(2), ), }, }, @@ -1245,12 +1245,12 @@ func TestExpectKnownOutputValueAtPath_CheckState_SetNestedBlock(t *testing.T) { statecheck.ExpectKnownOutputValueAtPath( "test_resource_one_output", tfjsonpath.New("set_nested_block"), - knownvalue.SetValueExact([]knownvalue.Check{ - knownvalue.MapValueExact(map[string]knownvalue.Check{ - "set_nested_block_attribute": knownvalue.StringValueExact("str"), + knownvalue.SetExact([]knownvalue.Check{ + knownvalue.MapExact(map[string]knownvalue.Check{ + "set_nested_block_attribute": knownvalue.StringExact("str"), }), - knownvalue.MapValueExact(map[string]knownvalue.Check{ - "set_nested_block_attribute": knownvalue.StringValueExact("rts"), + knownvalue.MapExact(map[string]knownvalue.Check{ + "set_nested_block_attribute": knownvalue.StringExact("rts"), }), }), ), @@ -1288,9 +1288,9 @@ func TestExpectKnownOutputValueAtPath_CheckState_SetNestedBlockPartial(t *testin statecheck.ExpectKnownOutputValueAtPath( "test_resource_one_output", tfjsonpath.New("set_nested_block"), - knownvalue.SetValuePartial([]knownvalue.Check{ - knownvalue.MapValueExact(map[string]knownvalue.Check{ - "set_nested_block_attribute": knownvalue.StringValueExact("rts"), + knownvalue.SetPartial([]knownvalue.Check{ + knownvalue.MapExact(map[string]knownvalue.Check{ + "set_nested_block_attribute": knownvalue.StringExact("rts"), }), }), ), @@ -1328,7 +1328,7 @@ func TestExpectKnownOutputValueAtPath_CheckState_SetNestedBlockElements(t *testi statecheck.ExpectKnownOutputValueAtPath( "test_resource_one_output", tfjsonpath.New("set_nested_block"), - knownvalue.SetElementsExact(2), + knownvalue.SetSizeExact(2), ), }, }, @@ -1359,7 +1359,7 @@ func TestExpectKnownOutputValueAtPath_CheckState_String(t *testing.T) { statecheck.ExpectKnownOutputValueAtPath( "test_resource_one_output", tfjsonpath.New("string_attribute"), - knownvalue.StringValueExact("str")), + knownvalue.StringExact("str")), }, }, }, @@ -1389,9 +1389,9 @@ func TestExpectKnownOutputValueAtPath_CheckState_String_KnownValueWrongType(t *t statecheck.ExpectKnownOutputValueAtPath( "test_resource_one_output", tfjsonpath.New("string_attribute"), - knownvalue.BoolValueExact(true)), + knownvalue.BoolExact(true)), }, - ExpectError: regexp.MustCompile("expected bool value for BoolValueExact check, got: string"), + ExpectError: regexp.MustCompile("expected bool value for BoolExact check, got: string"), }, }, }) @@ -1420,9 +1420,9 @@ func TestExpectKnownOutputValueAtPath_CheckState_String_KnownValueWrongValue(t * statecheck.ExpectKnownOutputValueAtPath( "test_resource_one_output", tfjsonpath.New("string_attribute"), - knownvalue.StringValueExact("rts")), + knownvalue.StringExact("rts")), }, - ExpectError: regexp.MustCompile("expected value rts for StringValueExact check, got: str"), + ExpectError: regexp.MustCompile("expected value rts for StringExact check, got: str"), }, }, }) @@ -1437,7 +1437,7 @@ func TestExpectKnownOutputValueAtPath_CheckState_UnknownAttributeType(t *testing expectedErr error }{ "unrecognised-type": { - knownValue: knownvalue.Int64ValueExact(123), + knownValue: knownvalue.Int64Exact(123), req: statecheck.CheckStateRequest{ State: &tfjson.State{ Values: &tfjson.StateValues{ @@ -1449,7 +1449,7 @@ func TestExpectKnownOutputValueAtPath_CheckState_UnknownAttributeType(t *testing }, }, }, - expectedErr: fmt.Errorf("expected json.Number value for Int64ValueExact check, got: float32"), + expectedErr: fmt.Errorf("expected json.Number value for Int64Exact check, got: float32"), }, } diff --git a/statecheck/expect_known_output_value_test.go b/statecheck/expect_known_output_value_test.go index e4af792d5..612891f74 100644 --- a/statecheck/expect_known_output_value_test.go +++ b/statecheck/expect_known_output_value_test.go @@ -41,7 +41,7 @@ func TestExpectKnownOutputValue_CheckState_OutputNotFound(t *testing.T) { ConfigStateChecks: r.ConfigStateChecks{ statecheck.ExpectKnownOutputValue( "bool_not_found", - knownvalue.BoolValueExact(true), + knownvalue.BoolExact(true), ), }, ExpectError: regexp.MustCompile("bool_not_found - Output not found in state"), @@ -73,7 +73,7 @@ func TestExpectKnownOutputValue_CheckState_AttributeValueNull(t *testing.T) { ConfigStateChecks: r.ConfigStateChecks{ statecheck.ExpectKnownOutputValue( "bool_output", - knownvalue.BoolValueExact(true), + knownvalue.BoolExact(true), ), }, ExpectError: regexp.MustCompile("bool_output - Output not found in state"), @@ -104,7 +104,7 @@ func TestExpectKnownOutputValue_CheckState_Bool(t *testing.T) { ConfigStateChecks: r.ConfigStateChecks{ statecheck.ExpectKnownOutputValue( "bool_output", - knownvalue.BoolValueExact(true), + knownvalue.BoolExact(true), ), }, }, @@ -134,10 +134,10 @@ func TestExpectKnownOutputValue_CheckState_Bool_KnownValueWrongType(t *testing.T ConfigStateChecks: r.ConfigStateChecks{ statecheck.ExpectKnownOutputValue( "bool_output", - knownvalue.Float64ValueExact(1.23), + knownvalue.Float64Exact(1.23), ), }, - ExpectError: regexp.MustCompile(`expected json\.Number value for Float64ValueExact check, got: bool`), + ExpectError: regexp.MustCompile(`expected json\.Number value for Float64Exact check, got: bool`), }, }, }) @@ -165,10 +165,10 @@ func TestExpectKnownOutputValue_CheckState_Bool_KnownValueWrongValue(t *testing. ConfigStateChecks: r.ConfigStateChecks{ statecheck.ExpectKnownOutputValue( "bool_output", - knownvalue.BoolValueExact(false), + knownvalue.BoolExact(false), ), }, - ExpectError: regexp.MustCompile("expected value false for BoolValueExact check, got: true"), + ExpectError: regexp.MustCompile("expected value false for BoolExact check, got: true"), }, }, }) @@ -196,7 +196,7 @@ func TestExpectKnownOutputValue_CheckState_Float64(t *testing.T) { ConfigStateChecks: r.ConfigStateChecks{ statecheck.ExpectKnownOutputValue( "float64_output", - knownvalue.Float64ValueExact(1.23), + knownvalue.Float64Exact(1.23), ), }, }, @@ -227,10 +227,10 @@ func TestExpectKnownOutputValue_CheckState_Float64_KnownValueWrongType(t *testin ConfigStateChecks: r.ConfigStateChecks{ statecheck.ExpectKnownOutputValue( "float64_output", - knownvalue.StringValueExact("str"), + knownvalue.StringExact("str"), ), }, - ExpectError: regexp.MustCompile(`expected string value for StringValueExact check, got: json\.Number`), + ExpectError: regexp.MustCompile(`expected string value for StringExact check, got: json\.Number`), }, }, }) @@ -258,10 +258,10 @@ func TestExpectKnownOutputValue_CheckState_Float64_KnownValueWrongValue(t *testi ConfigStateChecks: r.ConfigStateChecks{ statecheck.ExpectKnownOutputValue( "float64_output", - knownvalue.Float64ValueExact(3.21), + knownvalue.Float64Exact(3.21), ), }, - ExpectError: regexp.MustCompile("expected value 3.21 for Float64ValueExact check, got: 1.23"), + ExpectError: regexp.MustCompile("expected value 3.21 for Float64Exact check, got: 1.23"), }, }, }) @@ -289,7 +289,7 @@ func TestExpectKnownOutputValue_CheckState_Int64(t *testing.T) { ConfigStateChecks: r.ConfigStateChecks{ statecheck.ExpectKnownOutputValue( "int64_output", - knownvalue.Int64ValueExact(123), + knownvalue.Int64Exact(123), ), }, }, @@ -319,10 +319,10 @@ func TestExpectKnownOutputValue_CheckState_Int64_KnownValueWrongValue(t *testing ConfigStateChecks: r.ConfigStateChecks{ statecheck.ExpectKnownOutputValue( "int64_output", - knownvalue.Int64ValueExact(321), + knownvalue.Int64Exact(321), ), }, - ExpectError: regexp.MustCompile("expected value 321 for Int64ValueExact check, got: 123"), + ExpectError: regexp.MustCompile("expected value 321 for Int64Exact check, got: 123"), }, }, }) @@ -353,9 +353,9 @@ func TestExpectKnownOutputValue_CheckState_List(t *testing.T) { ConfigStateChecks: r.ConfigStateChecks{ statecheck.ExpectKnownOutputValue( "list_output", - knownvalue.ListValueExact([]knownvalue.Check{ - knownvalue.StringValueExact("value1"), - knownvalue.StringValueExact("value2"), + knownvalue.ListExact([]knownvalue.Check{ + knownvalue.StringExact("value1"), + knownvalue.StringExact("value2"), }), ), }, @@ -389,10 +389,10 @@ func TestExpectKnownOutputValue_CheckState_List_KnownValueWrongType(t *testing.T ConfigStateChecks: r.ConfigStateChecks{ statecheck.ExpectKnownOutputValue( "list_output", - knownvalue.MapValueExact(map[string]knownvalue.Check{}), + knownvalue.MapExact(map[string]knownvalue.Check{}), ), }, - ExpectError: regexp.MustCompile(`expected map\[string\]any value for MapValueExact check, got: \[\]interface {}`), + ExpectError: regexp.MustCompile(`expected map\[string\]any value for MapExact check, got: \[\]interface {}`), }, }, }) @@ -423,13 +423,13 @@ func TestExpectKnownOutputValue_CheckState_List_KnownValueWrongValue(t *testing. ConfigStateChecks: r.ConfigStateChecks{ statecheck.ExpectKnownOutputValue( "list_output", - knownvalue.ListValueExact([]knownvalue.Check{ - knownvalue.StringValueExact("value3"), - knownvalue.StringValueExact("value4"), + knownvalue.ListExact([]knownvalue.Check{ + knownvalue.StringExact("value3"), + knownvalue.StringExact("value4"), }), ), }, - ExpectError: regexp.MustCompile(`list element index 0: expected value value3 for StringValueExact check, got: value1`), + ExpectError: regexp.MustCompile(`list element index 0: expected value value3 for StringExact check, got: value1`), }, }, }) @@ -460,8 +460,8 @@ func TestExpectKnownOutputValue_CheckState_ListPartial(t *testing.T) { ConfigStateChecks: r.ConfigStateChecks{ statecheck.ExpectKnownOutputValue( "list_output", - knownvalue.ListValuePartial(map[int]knownvalue.Check{ - 0: knownvalue.StringValueExact("value1"), + knownvalue.ListPartial(map[int]knownvalue.Check{ + 0: knownvalue.StringExact("value1"), }), ), }, @@ -497,12 +497,12 @@ func TestExpectKnownOutputValue_CheckState_ListPartial_KnownValueWrongValue(t *t ConfigStateChecks: r.ConfigStateChecks{ statecheck.ExpectKnownOutputValue( "list_output", - knownvalue.ListValuePartial(map[int]knownvalue.Check{ - 0: knownvalue.StringValueExact("value3"), + knownvalue.ListPartial(map[int]knownvalue.Check{ + 0: knownvalue.StringExact("value3"), }), ), }, - ExpectError: regexp.MustCompile(`list element 0: expected value value3 for StringValueExact check, got: value1`), + ExpectError: regexp.MustCompile(`list element 0: expected value value3 for StringExact check, got: value1`), }, }, }) @@ -533,7 +533,7 @@ func TestExpectKnownOutputValue_CheckState_ListElements(t *testing.T) { ConfigStateChecks: r.ConfigStateChecks{ statecheck.ExpectKnownOutputValue( "list_output", - knownvalue.ListElementsExact(2), + knownvalue.ListSizeExact(2), ), }, }, @@ -566,10 +566,10 @@ func TestExpectKnownOutputValue_CheckState_ListElements_WrongNum(t *testing.T) { ConfigStateChecks: r.ConfigStateChecks{ statecheck.ExpectKnownOutputValue( "list_output", - knownvalue.ListElementsExact(3), + knownvalue.ListSizeExact(3), ), }, - ExpectError: regexp.MustCompile("expected 3 elements for ListElementsExact check, got 2 elements"), + ExpectError: regexp.MustCompile("expected 3 elements for ListSizeExact check, got 2 elements"), }, }, }) @@ -602,12 +602,12 @@ func TestExpectKnownOutputValue_CheckState_ListNestedBlock(t *testing.T) { ConfigStateChecks: r.ConfigStateChecks{ statecheck.ExpectKnownOutputValue( "list_nested_block_output", - knownvalue.ListValueExact([]knownvalue.Check{ - knownvalue.MapValueExact(map[string]knownvalue.Check{ - "list_nested_block_attribute": knownvalue.StringValueExact("str"), + knownvalue.ListExact([]knownvalue.Check{ + knownvalue.MapExact(map[string]knownvalue.Check{ + "list_nested_block_attribute": knownvalue.StringExact("str"), }), - knownvalue.MapValueExact(map[string]knownvalue.Check{ - "list_nested_block_attribute": knownvalue.StringValueExact("rts"), + knownvalue.MapExact(map[string]knownvalue.Check{ + "list_nested_block_attribute": knownvalue.StringExact("rts"), }), }), ), @@ -644,9 +644,9 @@ func TestExpectKnownOutputValue_CheckState_ListNestedBlockPartial(t *testing.T) ConfigStateChecks: r.ConfigStateChecks{ statecheck.ExpectKnownOutputValue( "list_nested_block_output", - knownvalue.ListValuePartial(map[int]knownvalue.Check{ - 1: knownvalue.MapValueExact(map[string]knownvalue.Check{ - "list_nested_block_attribute": knownvalue.StringValueExact("rts"), + knownvalue.ListPartial(map[int]knownvalue.Check{ + 1: knownvalue.MapExact(map[string]knownvalue.Check{ + "list_nested_block_attribute": knownvalue.StringExact("rts"), }), }), ), @@ -683,7 +683,7 @@ func TestExpectKnownOutputValue_CheckState_ListNestedBlockElements(t *testing.T) ConfigStateChecks: r.ConfigStateChecks{ statecheck.ExpectKnownOutputValue( "list_nested_block_output", - knownvalue.ListElementsExact(2), + knownvalue.ListSizeExact(2), ), }, }, @@ -716,9 +716,9 @@ func TestExpectKnownOutputValue_CheckState_Map(t *testing.T) { ConfigStateChecks: r.ConfigStateChecks{ statecheck.ExpectKnownOutputValue( "map_output", - knownvalue.MapValueExact(map[string]knownvalue.Check{ - "key1": knownvalue.StringValueExact("value1"), - "key2": knownvalue.StringValueExact("value2"), + knownvalue.MapExact(map[string]knownvalue.Check{ + "key1": knownvalue.StringExact("value1"), + "key2": knownvalue.StringExact("value2"), }), ), }, @@ -752,10 +752,10 @@ func TestExpectKnownOutputValue_CheckState_Map_KnownValueWrongType(t *testing.T) ConfigStateChecks: r.ConfigStateChecks{ statecheck.ExpectKnownOutputValue( "map_output", - knownvalue.ListValueExact([]knownvalue.Check{}), + knownvalue.ListExact([]knownvalue.Check{}), ), }, - ExpectError: regexp.MustCompile(`expected \[\]any value for ListValueExact check, got: map\[string\]interface {}`), + ExpectError: regexp.MustCompile(`expected \[\]any value for ListExact check, got: map\[string\]interface {}`), }, }, }) @@ -786,13 +786,13 @@ func TestExpectKnownOutputValue_CheckState_Map_KnownValueWrongValue(t *testing.T ConfigStateChecks: r.ConfigStateChecks{ statecheck.ExpectKnownOutputValue( "map_output", - knownvalue.MapValueExact(map[string]knownvalue.Check{ - "key3": knownvalue.StringValueExact("value3"), - "key4": knownvalue.StringValueExact("value4"), + knownvalue.MapExact(map[string]knownvalue.Check{ + "key3": knownvalue.StringExact("value3"), + "key4": knownvalue.StringExact("value4"), }), ), }, - ExpectError: regexp.MustCompile(`missing element key3 for MapValueExact check`), + ExpectError: regexp.MustCompile(`missing element key3 for MapExact check`), }, }, }) @@ -823,8 +823,8 @@ func TestExpectKnownOutputValue_CheckState_MapPartial(t *testing.T) { ConfigStateChecks: r.ConfigStateChecks{ statecheck.ExpectKnownOutputValue( "map_output", - knownvalue.MapValuePartial(map[string]knownvalue.Check{ - "key1": knownvalue.StringValueExact("value1"), + knownvalue.MapPartial(map[string]knownvalue.Check{ + "key1": knownvalue.StringExact("value1"), }), ), }, @@ -858,12 +858,12 @@ func TestExpectKnownOutputValue_CheckState_MapPartial_KnownValueWrongValue(t *te ConfigStateChecks: r.ConfigStateChecks{ statecheck.ExpectKnownOutputValue( "map_output", - knownvalue.MapValuePartial(map[string]knownvalue.Check{ - "key3": knownvalue.StringValueExact("value1"), + knownvalue.MapPartial(map[string]knownvalue.Check{ + "key3": knownvalue.StringExact("value1"), }), ), }, - ExpectError: regexp.MustCompile(`missing element key3 for MapValuePartial check`), + ExpectError: regexp.MustCompile(`missing element key3 for MapPartial check`), }, }, }) @@ -894,7 +894,7 @@ func TestExpectKnownOutputValue_CheckState_MapElements(t *testing.T) { ConfigStateChecks: r.ConfigStateChecks{ statecheck.ExpectKnownOutputValue( "map_output", - knownvalue.MapElementsExact(2), + knownvalue.MapSizeExact(2), ), }, }, @@ -927,10 +927,10 @@ func TestExpectKnownOutputValue_CheckState_MapElements_WrongNum(t *testing.T) { ConfigStateChecks: r.ConfigStateChecks{ statecheck.ExpectKnownOutputValue( "map_output", - knownvalue.MapElementsExact(3), + knownvalue.MapSizeExact(3), ), }, - ExpectError: regexp.MustCompile("expected 3 elements for MapElementsExact check, got 2 elements"), + ExpectError: regexp.MustCompile("expected 3 elements for MapSizeExact check, got 2 elements"), }, }, }) @@ -964,7 +964,7 @@ func TestExpectKnownOutputValue_CheckState_Number(t *testing.T) { ConfigStateChecks: r.ConfigStateChecks{ statecheck.ExpectKnownOutputValue( "int64_output", - knownvalue.NumberValueExact(f), + knownvalue.NumberExact(f), ), }, }, @@ -1000,10 +1000,10 @@ func TestExpectKnownOutputValue_CheckState_Number_KnownValueWrongValue(t *testin ConfigStateChecks: r.ConfigStateChecks{ statecheck.ExpectKnownOutputValue( "int64_output", - knownvalue.NumberValueExact(f), + knownvalue.NumberExact(f), ), }, - ExpectError: regexp.MustCompile("expected value 321 for NumberValueExact check, got: 123"), + ExpectError: regexp.MustCompile("expected value 321 for NumberExact check, got: 123"), }, }, }) @@ -1034,9 +1034,9 @@ func TestExpectKnownOutputValue_CheckState_Set(t *testing.T) { ConfigStateChecks: r.ConfigStateChecks{ statecheck.ExpectKnownOutputValue( "set_output", - knownvalue.SetValueExact([]knownvalue.Check{ - knownvalue.StringValueExact("value1"), - knownvalue.StringValueExact("value2"), + knownvalue.SetExact([]knownvalue.Check{ + knownvalue.StringExact("value1"), + knownvalue.StringExact("value2"), }), ), }, @@ -1070,13 +1070,13 @@ func TestExpectKnownOutputValue_CheckState_Set_KnownValueWrongValue(t *testing.T ConfigStateChecks: r.ConfigStateChecks{ statecheck.ExpectKnownOutputValue( "set_output", - knownvalue.SetValueExact([]knownvalue.Check{ - knownvalue.StringValueExact("value1"), - knownvalue.StringValueExact("value3"), + knownvalue.SetExact([]knownvalue.Check{ + knownvalue.StringExact("value1"), + knownvalue.StringExact("value3"), }), ), }, - ExpectError: regexp.MustCompile(`missing value value3 for SetValueExact check`), + ExpectError: regexp.MustCompile(`missing value value3 for SetExact check`), }, }, }) @@ -1107,8 +1107,8 @@ func TestExpectKnownOutputValue_CheckState_SetPartial(t *testing.T) { ConfigStateChecks: r.ConfigStateChecks{ statecheck.ExpectKnownOutputValue( "set_output", - knownvalue.SetValuePartial([]knownvalue.Check{ - knownvalue.StringValueExact("value2"), + knownvalue.SetPartial([]knownvalue.Check{ + knownvalue.StringExact("value2"), }), ), }, @@ -1142,12 +1142,12 @@ func TestExpectKnownOutputValue_CheckState_SetPartial_KnownValueWrongValue(t *te ConfigStateChecks: r.ConfigStateChecks{ statecheck.ExpectKnownOutputValue( "set_output", - knownvalue.SetValuePartial([]knownvalue.Check{ - knownvalue.StringValueExact("value3"), + knownvalue.SetPartial([]knownvalue.Check{ + knownvalue.StringExact("value3"), }), ), }, - ExpectError: regexp.MustCompile(`missing value value3 for SetValuePartial check`), + ExpectError: regexp.MustCompile(`missing value value3 for SetPartial check`), }, }, }) @@ -1178,7 +1178,7 @@ func TestExpectKnownOutputValue_CheckState_SetElements(t *testing.T) { ConfigStateChecks: r.ConfigStateChecks{ statecheck.ExpectKnownOutputValue( "set_output", - knownvalue.SetElementsExact(2), + knownvalue.SetSizeExact(2), ), }, }, @@ -1213,12 +1213,12 @@ func TestExpectKnownOutputValue_CheckState_SetNestedBlock(t *testing.T) { ConfigStateChecks: r.ConfigStateChecks{ statecheck.ExpectKnownOutputValue( "set_nested_block_output", - knownvalue.SetValueExact([]knownvalue.Check{ - knownvalue.MapValueExact(map[string]knownvalue.Check{ - "set_nested_block_attribute": knownvalue.StringValueExact("str"), + knownvalue.SetExact([]knownvalue.Check{ + knownvalue.MapExact(map[string]knownvalue.Check{ + "set_nested_block_attribute": knownvalue.StringExact("str"), }), - knownvalue.MapValueExact(map[string]knownvalue.Check{ - "set_nested_block_attribute": knownvalue.StringValueExact("rts"), + knownvalue.MapExact(map[string]knownvalue.Check{ + "set_nested_block_attribute": knownvalue.StringExact("rts"), }), }), ), @@ -1255,9 +1255,9 @@ func TestExpectKnownOutputValue_CheckState_SetNestedBlockPartial(t *testing.T) { ConfigStateChecks: r.ConfigStateChecks{ statecheck.ExpectKnownOutputValue( "set_nested_block_output", - knownvalue.SetValuePartial([]knownvalue.Check{ - knownvalue.MapValueExact(map[string]knownvalue.Check{ - "set_nested_block_attribute": knownvalue.StringValueExact("rts"), + knownvalue.SetPartial([]knownvalue.Check{ + knownvalue.MapExact(map[string]knownvalue.Check{ + "set_nested_block_attribute": knownvalue.StringExact("rts"), }), }), ), @@ -1294,7 +1294,7 @@ func TestExpectKnownOutputValue_CheckState_SetNestedBlockElements(t *testing.T) ConfigStateChecks: r.ConfigStateChecks{ statecheck.ExpectKnownOutputValue( "set_nested_block_output", - knownvalue.SetElementsExact(2), + knownvalue.SetSizeExact(2), ), }, }, @@ -1324,7 +1324,7 @@ func TestExpectKnownOutputValue_CheckState_String(t *testing.T) { ConfigStateChecks: r.ConfigStateChecks{ statecheck.ExpectKnownOutputValue( "string_output", - knownvalue.StringValueExact("str")), + knownvalue.StringExact("str")), }, }, }, @@ -1353,9 +1353,9 @@ func TestExpectKnownOutputValue_CheckState_String_KnownValueWrongType(t *testing ConfigStateChecks: r.ConfigStateChecks{ statecheck.ExpectKnownOutputValue( "string_output", - knownvalue.BoolValueExact(true)), + knownvalue.BoolExact(true)), }, - ExpectError: regexp.MustCompile("expected bool value for BoolValueExact check, got: string"), + ExpectError: regexp.MustCompile("expected bool value for BoolExact check, got: string"), }, }, }) @@ -1383,9 +1383,9 @@ func TestExpectKnownOutputValue_CheckState_String_KnownValueWrongValue(t *testin ConfigStateChecks: r.ConfigStateChecks{ statecheck.ExpectKnownOutputValue( "string_output", - knownvalue.StringValueExact("rts")), + knownvalue.StringExact("rts")), }, - ExpectError: regexp.MustCompile("expected value rts for StringValueExact check, got: str"), + ExpectError: regexp.MustCompile("expected value rts for StringExact check, got: str"), }, }, }) @@ -1400,7 +1400,7 @@ func TestExpectKnownOutputValue_CheckState_UnknownAttributeType(t *testing.T) { expectedErr error }{ "unrecognised-type": { - knownValue: knownvalue.Int64ValueExact(123), + knownValue: knownvalue.Int64Exact(123), req: statecheck.CheckStateRequest{ State: &tfjson.State{ Values: &tfjson.StateValues{ @@ -1412,7 +1412,7 @@ func TestExpectKnownOutputValue_CheckState_UnknownAttributeType(t *testing.T) { }, }, }, - expectedErr: fmt.Errorf("expected json.Number value for Int64ValueExact check, got: float32"), + expectedErr: fmt.Errorf("expected json.Number value for Int64Exact check, got: float32"), }, } diff --git a/statecheck/expect_known_value_test.go b/statecheck/expect_known_value_test.go index c95086d4b..e275212de 100644 --- a/statecheck/expect_known_value_test.go +++ b/statecheck/expect_known_value_test.go @@ -40,7 +40,7 @@ func TestExpectKnownValue_CheckState_ResourceNotFound(t *testing.T) { statecheck.ExpectKnownValue( "test_resource.two", tfjsonpath.New("bool_attribute"), - knownvalue.BoolValueExact(true), + knownvalue.BoolExact(true), ), }, ExpectError: regexp.MustCompile("test_resource.two - Resource not found in state"), @@ -65,7 +65,7 @@ func TestExpectKnownValue_CheckState_AttributeValueNull(t *testing.T) { statecheck.ExpectKnownValue( "test_resource.one", tfjsonpath.New("bool_attribute"), - knownvalue.NullValueExact(), + knownvalue.NullExact(), ), }, }, @@ -92,7 +92,7 @@ func TestExpectKnownValue_CheckState_Bool(t *testing.T) { statecheck.ExpectKnownValue( "test_resource.one", tfjsonpath.New("bool_attribute"), - knownvalue.BoolValueExact(true), + knownvalue.BoolExact(true), ), }, }, @@ -119,10 +119,10 @@ func TestExpectKnownValue_CheckState_Bool_KnownValueWrongType(t *testing.T) { statecheck.ExpectKnownValue( "test_resource.one", tfjsonpath.New("bool_attribute"), - knownvalue.Float64ValueExact(1.23), + knownvalue.Float64Exact(1.23), ), }, - ExpectError: regexp.MustCompile(`expected json\.Number value for Float64ValueExact check, got: bool`), + ExpectError: regexp.MustCompile(`expected json\.Number value for Float64Exact check, got: bool`), }, }, }) @@ -147,10 +147,10 @@ func TestExpectKnownValue_CheckState_Bool_KnownValueWrongValue(t *testing.T) { statecheck.ExpectKnownValue( "test_resource.one", tfjsonpath.New("bool_attribute"), - knownvalue.BoolValueExact(false), + knownvalue.BoolExact(false), ), }, - ExpectError: regexp.MustCompile("expected value false for BoolValueExact check, got: true"), + ExpectError: regexp.MustCompile("expected value false for BoolExact check, got: true"), }, }, }) @@ -175,7 +175,7 @@ func TestExpectKnownValue_CheckState_Float64(t *testing.T) { statecheck.ExpectKnownValue( "test_resource.one", tfjsonpath.New("float_attribute"), - knownvalue.Float64ValueExact(1.23), + knownvalue.Float64Exact(1.23), ), }, }, @@ -203,10 +203,10 @@ func TestExpectKnownValue_CheckState_Float64_KnownValueWrongType(t *testing.T) { statecheck.ExpectKnownValue( "test_resource.one", tfjsonpath.New("float_attribute"), - knownvalue.StringValueExact("str"), + knownvalue.StringExact("str"), ), }, - ExpectError: regexp.MustCompile(`expected string value for StringValueExact check, got: json\.Number`), + ExpectError: regexp.MustCompile(`expected string value for StringExact check, got: json\.Number`), }, }, }) @@ -231,10 +231,10 @@ func TestExpectKnownValue_CheckState_Float64_KnownValueWrongValue(t *testing.T) statecheck.ExpectKnownValue( "test_resource.one", tfjsonpath.New("float_attribute"), - knownvalue.Float64ValueExact(3.21), + knownvalue.Float64Exact(3.21), ), }, - ExpectError: regexp.MustCompile("expected value 3.21 for Float64ValueExact check, got: 1.23"), + ExpectError: regexp.MustCompile("expected value 3.21 for Float64Exact check, got: 1.23"), }, }, }) @@ -259,7 +259,7 @@ func TestExpectKnownValue_CheckState_Int64(t *testing.T) { statecheck.ExpectKnownValue( "test_resource.one", tfjsonpath.New("int_attribute"), - knownvalue.Int64ValueExact(123), + knownvalue.Int64Exact(123), ), }, }, @@ -286,10 +286,10 @@ func TestExpectKnownValue_CheckState_Int64_KnownValueWrongValue(t *testing.T) { statecheck.ExpectKnownValue( "test_resource.one", tfjsonpath.New("int_attribute"), - knownvalue.Int64ValueExact(321), + knownvalue.Int64Exact(321), ), }, - ExpectError: regexp.MustCompile("expected value 321 for Int64ValueExact check, got: 123"), + ExpectError: regexp.MustCompile("expected value 321 for Int64Exact check, got: 123"), }, }, }) @@ -317,9 +317,9 @@ func TestExpectKnownValue_CheckState_List(t *testing.T) { statecheck.ExpectKnownValue( "test_resource.one", tfjsonpath.New("list_attribute"), - knownvalue.ListValueExact([]knownvalue.Check{ - knownvalue.StringValueExact("value1"), - knownvalue.StringValueExact("value2"), + knownvalue.ListExact([]knownvalue.Check{ + knownvalue.StringExact("value1"), + knownvalue.StringExact("value2"), }), ), }, @@ -350,10 +350,10 @@ func TestExpectKnownValue_CheckState_List_KnownValueWrongType(t *testing.T) { statecheck.ExpectKnownValue( "test_resource.one", tfjsonpath.New("list_attribute"), - knownvalue.MapValueExact(map[string]knownvalue.Check{}), + knownvalue.MapExact(map[string]knownvalue.Check{}), ), }, - ExpectError: regexp.MustCompile(`expected map\[string\]any value for MapValueExact check, got: \[\]interface {}`), + ExpectError: regexp.MustCompile(`expected map\[string\]any value for MapExact check, got: \[\]interface {}`), }, }, }) @@ -381,13 +381,13 @@ func TestExpectKnownValue_CheckState_List_KnownValueWrongValue(t *testing.T) { statecheck.ExpectKnownValue( "test_resource.one", tfjsonpath.New("list_attribute"), - knownvalue.ListValueExact([]knownvalue.Check{ - knownvalue.StringValueExact("value3"), - knownvalue.StringValueExact("value4"), + knownvalue.ListExact([]knownvalue.Check{ + knownvalue.StringExact("value3"), + knownvalue.StringExact("value4"), }), ), }, - ExpectError: regexp.MustCompile(`list element index 0: expected value value3 for StringValueExact check, got: value1`), + ExpectError: regexp.MustCompile(`list element index 0: expected value value3 for StringExact check, got: value1`), }, }, }) @@ -415,8 +415,8 @@ func TestExpectKnownValue_CheckState_ListPartial(t *testing.T) { statecheck.ExpectKnownValue( "test_resource.one", tfjsonpath.New("list_attribute"), - knownvalue.ListValuePartial(map[int]knownvalue.Check{ - 0: knownvalue.StringValueExact("value1"), + knownvalue.ListPartial(map[int]knownvalue.Check{ + 0: knownvalue.StringExact("value1"), }), ), }, @@ -449,12 +449,12 @@ func TestExpectKnownValue_CheckState_ListPartial_KnownValueWrongValue(t *testing statecheck.ExpectKnownValue( "test_resource.one", tfjsonpath.New("list_attribute"), - knownvalue.ListValuePartial(map[int]knownvalue.Check{ - 0: knownvalue.StringValueExact("value3"), + knownvalue.ListPartial(map[int]knownvalue.Check{ + 0: knownvalue.StringExact("value3"), }), ), }, - ExpectError: regexp.MustCompile(`list element 0: expected value value3 for StringValueExact check, got: value1`), + ExpectError: regexp.MustCompile(`list element 0: expected value value3 for StringExact check, got: value1`), }, }, }) @@ -482,7 +482,7 @@ func TestExpectKnownValue_CheckState_ListElements(t *testing.T) { statecheck.ExpectKnownValue( "test_resource.one", tfjsonpath.New("list_attribute"), - knownvalue.ListElementsExact(2), + knownvalue.ListSizeExact(2), ), }, }, @@ -512,10 +512,10 @@ func TestExpectKnownValue_CheckState_ListElements_WrongNum(t *testing.T) { statecheck.ExpectKnownValue( "test_resource.one", tfjsonpath.New("list_attribute"), - knownvalue.ListElementsExact(3), + knownvalue.ListSizeExact(3), ), }, - ExpectError: regexp.MustCompile("expected 3 elements for ListElementsExact check, got 2 elements"), + ExpectError: regexp.MustCompile("expected 3 elements for ListSizeExact check, got 2 elements"), }, }, }) @@ -545,12 +545,12 @@ func TestExpectKnownValue_CheckState_ListNestedBlock(t *testing.T) { statecheck.ExpectKnownValue( "test_resource.one", tfjsonpath.New("list_nested_block"), - knownvalue.ListValueExact([]knownvalue.Check{ - knownvalue.MapValueExact(map[string]knownvalue.Check{ - "list_nested_block_attribute": knownvalue.StringValueExact("str"), + knownvalue.ListExact([]knownvalue.Check{ + knownvalue.MapExact(map[string]knownvalue.Check{ + "list_nested_block_attribute": knownvalue.StringExact("str"), }), - knownvalue.MapValueExact(map[string]knownvalue.Check{ - "list_nested_block_attribute": knownvalue.StringValueExact("rts"), + knownvalue.MapExact(map[string]knownvalue.Check{ + "list_nested_block_attribute": knownvalue.StringExact("rts"), }), }), ), @@ -584,9 +584,9 @@ func TestExpectKnownValue_CheckState_ListNestedBlockPartial(t *testing.T) { statecheck.ExpectKnownValue( "test_resource.one", tfjsonpath.New("list_nested_block"), - knownvalue.ListValuePartial(map[int]knownvalue.Check{ - 1: knownvalue.MapValueExact(map[string]knownvalue.Check{ - "list_nested_block_attribute": knownvalue.StringValueExact("rts"), + knownvalue.ListPartial(map[int]knownvalue.Check{ + 1: knownvalue.MapExact(map[string]knownvalue.Check{ + "list_nested_block_attribute": knownvalue.StringExact("rts"), }), }), ), @@ -620,7 +620,7 @@ func TestExpectKnownValue_CheckState_ListNestedBlockElements(t *testing.T) { statecheck.ExpectKnownValue( "test_resource.one", tfjsonpath.New("list_nested_block"), - knownvalue.ListElementsExact(2), + knownvalue.ListSizeExact(2), ), }, }, @@ -650,9 +650,9 @@ func TestExpectKnownValue_CheckState_Map(t *testing.T) { statecheck.ExpectKnownValue( "test_resource.one", tfjsonpath.New("map_attribute"), - knownvalue.MapValueExact(map[string]knownvalue.Check{ - "key1": knownvalue.StringValueExact("value1"), - "key2": knownvalue.StringValueExact("value2"), + knownvalue.MapExact(map[string]knownvalue.Check{ + "key1": knownvalue.StringExact("value1"), + "key2": knownvalue.StringExact("value2"), }), ), }, @@ -683,10 +683,10 @@ func TestExpectKnownValue_CheckState_Map_KnownValueWrongType(t *testing.T) { statecheck.ExpectKnownValue( "test_resource.one", tfjsonpath.New("map_attribute"), - knownvalue.ListValueExact([]knownvalue.Check{}), + knownvalue.ListExact([]knownvalue.Check{}), ), }, - ExpectError: regexp.MustCompile(`expected \[\]any value for ListValueExact check, got: map\[string\]interface {}`), + ExpectError: regexp.MustCompile(`expected \[\]any value for ListExact check, got: map\[string\]interface {}`), }, }, }) @@ -714,13 +714,13 @@ func TestExpectKnownValue_CheckState_Map_KnownValueWrongValue(t *testing.T) { statecheck.ExpectKnownValue( "test_resource.one", tfjsonpath.New("map_attribute"), - knownvalue.MapValueExact(map[string]knownvalue.Check{ - "key3": knownvalue.StringValueExact("value3"), - "key4": knownvalue.StringValueExact("value4"), + knownvalue.MapExact(map[string]knownvalue.Check{ + "key3": knownvalue.StringExact("value3"), + "key4": knownvalue.StringExact("value4"), }), ), }, - ExpectError: regexp.MustCompile(`missing element key3 for MapValueExact check`), + ExpectError: regexp.MustCompile(`missing element key3 for MapExact check`), }, }, }) @@ -748,8 +748,8 @@ func TestExpectKnownValue_CheckState_MapPartial(t *testing.T) { statecheck.ExpectKnownValue( "test_resource.one", tfjsonpath.New("map_attribute"), - knownvalue.MapValuePartial(map[string]knownvalue.Check{ - "key1": knownvalue.StringValueExact("value1"), + knownvalue.MapPartial(map[string]knownvalue.Check{ + "key1": knownvalue.StringExact("value1"), }), ), }, @@ -780,12 +780,12 @@ func TestExpectKnownValue_CheckState_MapPartial_KnownValueWrongValue(t *testing. statecheck.ExpectKnownValue( "test_resource.one", tfjsonpath.New("map_attribute"), - knownvalue.MapValuePartial(map[string]knownvalue.Check{ - "key3": knownvalue.StringValueExact("value1"), + knownvalue.MapPartial(map[string]knownvalue.Check{ + "key3": knownvalue.StringExact("value1"), }), ), }, - ExpectError: regexp.MustCompile(`missing element key3 for MapValuePartial check`), + ExpectError: regexp.MustCompile(`missing element key3 for MapPartial check`), }, }, }) @@ -813,7 +813,7 @@ func TestExpectKnownValue_CheckState_MapElements(t *testing.T) { statecheck.ExpectKnownValue( "test_resource.one", tfjsonpath.New("map_attribute"), - knownvalue.MapElementsExact(2), + knownvalue.MapSizeExact(2), ), }, }, @@ -843,10 +843,10 @@ func TestExpectKnownValue_CheckState_MapElements_WrongNum(t *testing.T) { statecheck.ExpectKnownValue( "test_resource.one", tfjsonpath.New("map_attribute"), - knownvalue.MapElementsExact(3), + knownvalue.MapSizeExact(3), ), }, - ExpectError: regexp.MustCompile("expected 3 elements for MapElementsExact check, got 2 elements"), + ExpectError: regexp.MustCompile("expected 3 elements for MapSizeExact check, got 2 elements"), }, }, }) @@ -877,7 +877,7 @@ func TestExpectKnownValue_CheckState_Number(t *testing.T) { statecheck.ExpectKnownValue( "test_resource.one", tfjsonpath.New("int_attribute"), - knownvalue.NumberValueExact(f), + knownvalue.NumberExact(f), ), }, }, @@ -910,10 +910,10 @@ func TestExpectKnownValue_CheckState_Number_KnownValueWrongValue(t *testing.T) { statecheck.ExpectKnownValue( "test_resource.one", tfjsonpath.New("int_attribute"), - knownvalue.NumberValueExact(f), + knownvalue.NumberExact(f), ), }, - ExpectError: regexp.MustCompile("expected value 321 for NumberValueExact check, got: 123"), + ExpectError: regexp.MustCompile("expected value 321 for NumberExact check, got: 123"), }, }, }) @@ -941,9 +941,9 @@ func TestExpectKnownValue_CheckState_Set(t *testing.T) { statecheck.ExpectKnownValue( "test_resource.one", tfjsonpath.New("set_attribute"), - knownvalue.SetValueExact([]knownvalue.Check{ - knownvalue.StringValueExact("value2"), - knownvalue.StringValueExact("value1"), + knownvalue.SetExact([]knownvalue.Check{ + knownvalue.StringExact("value2"), + knownvalue.StringExact("value1"), }), ), }, @@ -974,13 +974,13 @@ func TestExpectKnownValue_CheckState_Set_KnownValueWrongValue(t *testing.T) { statecheck.ExpectKnownValue( "test_resource.one", tfjsonpath.New("set_attribute"), - knownvalue.SetValueExact([]knownvalue.Check{ - knownvalue.StringValueExact("value1"), - knownvalue.StringValueExact("value3"), + knownvalue.SetExact([]knownvalue.Check{ + knownvalue.StringExact("value1"), + knownvalue.StringExact("value3"), }), ), }, - ExpectError: regexp.MustCompile(`missing value value3 for SetValueExact check`), + ExpectError: regexp.MustCompile(`missing value value3 for SetExact check`), }, }, }) @@ -1008,8 +1008,8 @@ func TestExpectKnownValue_CheckState_SetPartial(t *testing.T) { statecheck.ExpectKnownValue( "test_resource.one", tfjsonpath.New("set_attribute"), - knownvalue.SetValuePartial([]knownvalue.Check{ - knownvalue.StringValueExact("value2"), + knownvalue.SetPartial([]knownvalue.Check{ + knownvalue.StringExact("value2"), }), ), }, @@ -1040,12 +1040,12 @@ func TestExpectKnownValue_CheckState_SetPartial_KnownValueWrongValue(t *testing. statecheck.ExpectKnownValue( "test_resource.one", tfjsonpath.New("set_attribute"), - knownvalue.SetValuePartial([]knownvalue.Check{ - knownvalue.StringValueExact("value3"), + knownvalue.SetPartial([]knownvalue.Check{ + knownvalue.StringExact("value3"), }), ), }, - ExpectError: regexp.MustCompile(`missing value value3 for SetValuePartial check`), + ExpectError: regexp.MustCompile(`missing value value3 for SetPartial check`), }, }, }) @@ -1073,7 +1073,7 @@ func TestExpectKnownValue_CheckState_SetElements(t *testing.T) { statecheck.ExpectKnownValue( "test_resource.one", tfjsonpath.New("set_attribute"), - knownvalue.SetElementsExact(2), + knownvalue.SetSizeExact(2), ), }, }, @@ -1105,12 +1105,12 @@ func TestExpectKnownValue_CheckState_SetNestedBlock(t *testing.T) { statecheck.ExpectKnownValue( "test_resource.one", tfjsonpath.New("set_nested_block"), - knownvalue.SetValueExact([]knownvalue.Check{ - knownvalue.MapValueExact(map[string]knownvalue.Check{ - "set_nested_block_attribute": knownvalue.StringValueExact("str"), + knownvalue.SetExact([]knownvalue.Check{ + knownvalue.MapExact(map[string]knownvalue.Check{ + "set_nested_block_attribute": knownvalue.StringExact("str"), }), - knownvalue.MapValueExact(map[string]knownvalue.Check{ - "set_nested_block_attribute": knownvalue.StringValueExact("rts"), + knownvalue.MapExact(map[string]knownvalue.Check{ + "set_nested_block_attribute": knownvalue.StringExact("rts"), }), }), ), @@ -1144,9 +1144,9 @@ func TestExpectKnownValue_CheckState_SetNestedBlockPartial(t *testing.T) { statecheck.ExpectKnownValue( "test_resource.one", tfjsonpath.New("set_nested_block"), - knownvalue.SetValuePartial([]knownvalue.Check{ - knownvalue.MapValueExact(map[string]knownvalue.Check{ - "set_nested_block_attribute": knownvalue.StringValueExact("rts"), + knownvalue.SetPartial([]knownvalue.Check{ + knownvalue.MapExact(map[string]knownvalue.Check{ + "set_nested_block_attribute": knownvalue.StringExact("rts"), }), }), ), @@ -1180,7 +1180,7 @@ func TestExpectKnownValue_CheckState_SetNestedBlockElements(t *testing.T) { statecheck.ExpectKnownValue( "test_resource.one", tfjsonpath.New("set_nested_block"), - knownvalue.SetElementsExact(2), + knownvalue.SetSizeExact(2), ), }, }, @@ -1207,7 +1207,7 @@ func TestExpectKnownValue_CheckState_String(t *testing.T) { statecheck.ExpectKnownValue( "test_resource.one", tfjsonpath.New("string_attribute"), - knownvalue.StringValueExact("str")), + knownvalue.StringExact("str")), }, }, }, @@ -1233,9 +1233,9 @@ func TestExpectKnownValue_CheckState_String_KnownValueWrongType(t *testing.T) { statecheck.ExpectKnownValue( "test_resource.one", tfjsonpath.New("string_attribute"), - knownvalue.BoolValueExact(true)), + knownvalue.BoolExact(true)), }, - ExpectError: regexp.MustCompile("expected bool value for BoolValueExact check, got: string"), + ExpectError: regexp.MustCompile("expected bool value for BoolExact check, got: string"), }, }, }) @@ -1260,9 +1260,9 @@ func TestExpectKnownValue_CheckState_String_KnownValueWrongValue(t *testing.T) { statecheck.ExpectKnownValue( "test_resource.one", tfjsonpath.New("string_attribute"), - knownvalue.StringValueExact("rts")), + knownvalue.StringExact("rts")), }, - ExpectError: regexp.MustCompile("expected value rts for StringValueExact check, got: str"), + ExpectError: regexp.MustCompile("expected value rts for StringExact check, got: str"), }, }, }) @@ -1277,7 +1277,7 @@ func TestExpectKnownValue_CheckState_UnknownAttributeType(t *testing.T) { expectedErr error }{ "unrecognised-type": { - knownValue: knownvalue.Int64ValueExact(123), + knownValue: knownvalue.Int64Exact(123), req: statecheck.CheckStateRequest{ State: &tfjson.State{ Values: &tfjson.StateValues{ @@ -1294,7 +1294,7 @@ func TestExpectKnownValue_CheckState_UnknownAttributeType(t *testing.T) { }, }, }, - expectedErr: fmt.Errorf("expected json.Number value for Int64ValueExact check, got: float32"), + expectedErr: fmt.Errorf("expected json.Number value for Int64Exact check, got: float32"), }, }