MCPcopy Create free account
hub / github.com/coder/coder / TestAppSlugDuplicate

Function TestAppSlugDuplicate

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

Source from the content-addressed store, hash-verified

1301}
1302
1303func TestAppSlugDuplicate(t *testing.T) {
1304 t.Parallel()
1305 ctx, logger := ctxAndLogger(t)
1306
1307 // nolint:dogsled
1308 _, filename, _, _ := runtime.Caller(0)
1309
1310 dir := filepath.Join(filepath.Dir(filename), "testdata", "resources", "multiple-apps")
1311 tfPlanRaw, err := os.ReadFile(filepath.Join(dir, "multiple-apps.tfplan.json"))
1312 require.NoError(t, err)
1313 var tfPlan tfjson.Plan
1314 err = json.Unmarshal(tfPlanRaw, &tfPlan)
1315 require.NoError(t, err)
1316 tfPlanGraph, err := os.ReadFile(filepath.Join(dir, "multiple-apps.tfplan.dot"))
1317 require.NoError(t, err)
1318
1319 for _, resource := range tfPlan.PlannedValues.RootModule.Resources {
1320 if resource.Type == "coder_app" {
1321 resource.AttributeValues["slug"] = "dev"
1322 }
1323 }
1324
1325 _, err = terraform.ConvertState(ctx, []*tfjson.StateModule{tfPlan.PlannedValues.RootModule}, string(tfPlanGraph), logger)
1326 require.Error(t, err)
1327 require.ErrorContains(t, err, "duplicate app slug")
1328}
1329
1330//nolint:tparallel
1331func TestAgentNameInvalid(t *testing.T) {

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