Skip to content

add AZT006: update tests must apply two different configs - #69

Merged
katbyte merged 4 commits into
mainfrom
kt/azt006-update-test-single-config
Oct 9, 2026
Merged

katbyte merged 4 commits into
mainfrom
kt/azt006-update-test-single-config

Conversation

@katbyte

@katbyte katbyte commented Oct 9, 2026

Copy link
Copy Markdown
Owner

A new rule, AZT006, that reports update tests applying a single config, or the same config more than once.

Why: an update test exists to run the resource's Update path. With one config it only proves the resource can be created, and with the same config twice the second apply is a no-op plan. The name says the update was tested when it never ran. A survey of azurerm found two such tests, the healthcare service identity update and the Security Center subscription pricing update, plus one scale set test that applies the same rolling-update config twice.

Update tests that never update. A test counts when a segment of its name after the first underscore starts with update, the same reading AZT005 uses, so _update, _updateSku and _list_update count and _autoUpdateEnabled does not. The configs are the Config values of the TestStep literals in the body, compared as written, so the same helper with different arguments is a different config. A test with no steps of its own delegates to a helper, and the helper is checked instead; lowercase testAcc helpers count, since sequential tests keep their steps there.

 	data.ResourceTest(t, r, []acceptance.TestStep{
+		{
+			Config: r.basic(data),
+		},
+		data.ImportStep(),
 		{
 			Config: r.complete(data),
 		},

Things that are fine as they are. Names where update is inside a word, such as imagesDisableAutomaticUpdate or AutoUpdates, are feature names and are not reported; a looser reading would have flagged four of those in azurerm. Delegating wrappers like the Cosmos DB account update tests, which hand off to a helper with the steps, are not reported either.

The rule only reports.

@katbyte
katbyte force-pushed the kt/azt006-update-test-single-config branch from c15a7d5 to 169519b Compare October 9, 2026 21:17
@katbyte
katbyte merged commit 98d93b0 into main Oct 9, 2026
11 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant