MCPcopy Index your code
hub / github.com/coder/coder / TestMetadataResourceDuplicate

Function TestMetadataResourceDuplicate

provisioner/terraform/resources_test.go:1412–1430  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

1410}
1411
1412func TestMetadataResourceDuplicate(t *testing.T) {
1413 t.Parallel()
1414 ctx, logger := ctxAndLogger(t)
1415
1416 // Load the multiple-apps state file and edit it.
1417 dir := filepath.Join("testdata", "resources", "resource-metadata-duplicate")
1418 tfPlanRaw, err := os.ReadFile(filepath.Join(dir, "resource-metadata-duplicate.tfplan.json"))
1419 require.NoError(t, err)
1420 var tfPlan tfjson.Plan
1421 err = json.Unmarshal(tfPlanRaw, &tfPlan)
1422 require.NoError(t, err)
1423 tfPlanGraph, err := os.ReadFile(filepath.Join(dir, "resource-metadata-duplicate.tfplan.dot"))
1424 require.NoError(t, err)
1425
1426 state, err := terraform.ConvertState(ctx, []*tfjson.StateModule{tfPlan.PlannedValues.RootModule}, string(tfPlanGraph), logger)
1427 require.Nil(t, state)
1428 require.Error(t, err)
1429 require.ErrorContains(t, err, "duplicate metadata resource: null_resource.about")
1430}
1431
1432func TestParameterValidation(t *testing.T) {
1433 t.Parallel()

Callers

nothing calls this directly

Calls 5

ConvertStateFunction · 0.92
ctxAndLoggerFunction · 0.85
ReadFileMethod · 0.65
UnmarshalMethod · 0.45
ErrorMethod · 0.45

Tested by

no test coverage detected