Closed EspenAlbert closed 1 month ago
@EspenAlbert I am trying to understand if the two things are related with each other: noOp
and setId
. Are they? Do we have acceptance tests in CI that are testing this path?
@marcosuma we have acceptance test for:
mongodbatlas_federated_settings_identity_provider
But no acceptance test running in CI for mongodbatlas_federated_settings_org_config
setId
must be called when a resource is created. This PR uses NoOp to be explicit about when the Create
is attempted. I removed the if d.Id() == "" { and SetId("")
since this code path was only hit during Create
(Update
and Import
explicitly use SetId
before calling the Read
method)Not sure if that answers your question.
WDYT? I can work on enabling the test in the CI or at least run in locally for mongodbatlas_federated_settings_org_config
@EspenAlbert it seems like those tests can't be enabled, because I see acc.SkipTestForCI(tb) // affects the org
as a comment. We should check with @AgustinBettati and team to see if there is a chance we can figure a way to enable them.
For sure running those tests locally is a workaround for this PR, make sure that removing SetId("")
does not change the behaviour or introduces a bug
@marcosuma I have been running the tests locally and found a few issues, I had a meeting with @AgustinBettati and we discussed how to test these.
I'm working on enabling some of these tests in the CI and having this PR ready for review. Later, I believe a follow-up PR with full CRUD functionality and testing can be added for federated_settings_identity_provider using OIDC
Great, let's try to improve testing around this area. Just to confirm (I am still a bit unsure I have fully understood):
if Id() == "" then SetId(""
wouldn't be enough. Can you confirm?Great, let's try to improve testing around this area. Just to confirm (I am still a bit unsure I have fully understood):
- you are adding the NoOp because by simply removing the
if Id() == "" then SetId(""
wouldn't be enough. Can you confirm?
Confirmed. After removing this check, it would fail on the read since Id()
would be empty, and the read call would fail.
- you have still not manage to test this correctly, right? I guess in this scenarios TDD can be handy
I have tested successfully 😄
Run in CI for the mongodbatlas_federated_settings_identity_provider
Local run for the TestAccFederatedSettingsOrg_basic
:
go test -timeout 2400s -run ^TestAccFederatedSettingsOrg_basic$ github.com/mongodb/terraform-provider-mongodbatlas/internal/service/federatedsettingsorgconfig -v
=== RUN TestAccFederatedSettingsOrg_basic
=== PAUSE TestAccFederatedSettingsOrg_basic
=== CONT TestAccFederatedSettingsOrg_basic
--- PASS: TestAccFederatedSettingsOrg_basic (11.90s)
PASS
ok github.com/mongodb/terraform-provider-mongodbatlas/internal/service/federatedsettingsorgconfig 13.028s
LGTM! Left some minor comments
Description
mongodbatlas_federated_settings_org_config
and refactored and run resource test locallymongodbatlas_federated_settings_identity_provider
This resource is not meant to be imported see docs (will get changed when we implement OIDC fully)
Original error showing:
After refactoring:
Link to any related issue(s): CLOUDP-248069
Type of change:
Required Checklist:
Further comments
mongodbatlas_federated_settings_org_config
test