[datadog_synthetics_test] Add javascript assertion to Synthetics Assertion #2576
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
SYNTH-14849
Context
We want to add the capabilities to create JS assertions with terraform
Important
Because the
javascript
assertion does not contains anyoperator
, we need to make theoperator
field of an assertionOptional
.Because we cannot validate a field based on another field in schema right now, it means we cannot make the
operator
optional only iftype
isjavascript
and make it required otherwise.This implies that we cannot validate anymore if the user forgot to add an
operator
for a nonjavascript
assertion, and terraform will still perform the request to dogweb and then display the validation error from dogweb.But we still have the
operator
validation, meaning terraform will fail if the user provide a wrongoperator
valueNow, we have thew options to deal with this issue:
javascript
assertion) and then display the error from dogweb :noOperator
or something like this. This would require a lot of work in the worker, frontend and api spec because we already created a bunch of type for this assertion assuming there is no operatorChange
NewSyntheticsAssertionJavascriptTypeFromValue
value to validate the assertiontype
valuecode
field to the assertionoperator
field to optionalbuildDatadogAssertions
to create javascript assertionbuildTerraformAssertions
to handle javascript assertionQA
Tested locally with the provider and it works