Skip to content

Conversation

zippolyte
Copy link
Contributor

deprecate typeMap request in favor of typeList request_definition

@zippolyte zippolyte requested review from a team as code owners January 26, 2021 14:25
Elem: syntheticsTestRequest(),
},
"request_definition": {
Description: "The synthetics test request. Required if `type = \"api\"` and `subtype = \"http\"`.",
Copy link
Member

@romainberger romainberger Jan 26, 2021

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This part may be legacy but Required if type = "api" and subtype = "http". is not true, it should be just Required if type = "api"

Copy link
Contributor

@nmuesch nmuesch left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code looks good to me. Couple minor questions on the tests

timeoutInt, _ := strconv.Atoi(attr.(string))
if attr, ok := k.GetOkWith("timeout"); ok {
var timeoutInt int
// first try to convert to int if we're getting from the new TypeList field
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sanity checking; is this because everything in a TypeMap is a string, regardless of what the Type is set as?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

yes

@@ -30,33 +30,6 @@ func TestAccDatadogSyntheticsAPITest_importBasic(t *testing.T) {
ResourceName: "datadog_synthetics_test.foo",
ImportState: true,
ImportStateVerify: true,
// Assertions will be imported into the new schema by default, but we can ignore them as users need to update the local config in this case
ImportStateVerifyIgnore: []string{"assertions", "assertion", "options", "options_list"},
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why remove this?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We want verification on these fields

})
}

func TestAccDatadogSyntheticsAPITest_importBasicNewAssertionsOptions(t *testing.T) {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Are we covering this import elsewhere?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Deprecated field cannot be imported, as the implementation of read prefers the new fields when not set in config (which is the case for import)
I modified the main test config to not have any deprecated fields in it, so the other import tests now does the proper verifications (without the importIgnore)
This one is then rendered useless, as it's just a duplication

@zippolyte zippolyte enabled auto-merge (squash) January 29, 2021 09:23
@zippolyte
Copy link
Contributor Author

/azp run

@azure-pipelines
Copy link

Azure Pipelines successfully started running 1 pipeline(s).

@zippolyte zippolyte merged commit 3b19775 into master Jan 29, 2021
@zippolyte zippolyte deleted the hippo/typemapsynt branch January 29, 2021 09:42
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.

3 participants