(t *testing.T)
| 1301 | } |
| 1302 | |
| 1303 | func 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 |
| 1331 | func TestAgentNameInvalid(t *testing.T) { |
nothing calls this directly
no test coverage detected