You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
# tests/main.tftest.hclvariables {
null_value=null
}
run"wireguard_config_document" {
assert {
condition=provider::assert::null(var.null_value)
error_message="Null should be null."
}
assert {
condition=provider::assert::null(data.wireguard_config_document.main.addresses)
error_message="Wireguard configuration does not have expected addresses."
}
}
The output from terraform test is as follows:
tests/main.tftest.hcl... in progress
run "wireguard_config_document"... fail
╷
│ Error: Test assertion failed
│
│ on tests/main.tftest.hcl line 12, in run "wireguard_config_document":
│ 12: condition = provider::assert::null(data.wireguard_config_document.main.addresses)
│ ├────────────────
│ │ data.wireguard_config_document.main.addresses is null
│
│ Wireguard configuration does not have expected addresses.
╵
tests/main.tftest.hcl... tearing down
tests/main.tftest.hcl... fail
Failure! 0 passed, 1 failed.
The text was updated successfully, but these errors were encountered:
Thanks for reporting this! I’ll take a look at it as soon as possible. At first glance it appears to be a duplicate of #71, but I’ll investigate further and provide more details later, with the possibility of consolidating both issues into one.
Thank you for reporting this issue. In v0.15.0, we merged a fix to evaluate the underlying value as null, which is necessary for cross-object references. Previously, the dynamic value of an argument was evaluated as either null or not. Additionally, we’ve disabled the allowance of unknown values being passed into not_null, which helps protect users from flaky assertions on argument references that may be unknown but could potentially be null or not.
It would be greatly appreciated if you could test this and let us know if it resolves your issue. I’ve also added a test to the null function that includes your provided Wireguard example, where addresses is always set to null. Thanks again!
I am seeing
provider::assert::null
returning false when given anull
value. Here is a simple example.The output from
terraform test
is as follows:The text was updated successfully, but these errors were encountered: