-
Notifications
You must be signed in to change notification settings - Fork 7
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[testing] Acceptance tests for rhoas_kafka #24
[testing] Acceptance tests for rhoas_kafka #24
Conversation
5dd619f
to
d13579e
Compare
1e691e7
to
5f89c15
Compare
if !strings.Contains(err.Error(), "not found") { | ||
return diag.FromErr(errors.Wrapf(err, "Error waiting for example instance (%s) to be deleted", d.Id())) | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Maybe I am missing something here but why do we not care about the error if it contains "not found"
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I found that sometimes the API returns an error "not found" when the resource has been deleted and the terraform provider fails. So I thought that a "not found" is OK if we are deleting the resource
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Okay this is kind of weird but maybe there is no way around it.
if err1.Error() == "404 Not Found" { | ||
return data, "404", nil | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why are we checking this just not sure? Also we will do more error handling in the future anyway so nothing needs to be perfect right now.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Similarly to this comment, I discovered that sometimes the API returns a "404 Not Found" and the delete function errors. I think that if we get a 404, there shouldn't be any error, as not finding the resource means it has been deleted.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Cool, bit weird but as I said not sure how to get around it right now.
…-rhoas into test-rhoas-kafka
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
👍
Summary
Added some acceptance tests for
rhoas_kafka
:TestAccRHOASKafka_Basic
: checks that we are able to spin up a Kafka cluster and delete it.TestAccRHOASKafka_Update
: checks that we are able to spin up a Kafka cluster, change its name and delete it.TestAccRHOASKafka_Error
: checks that an error is returned if the configuration is wrong. For example, if the cloud provider isn't supported.Testing
Run
make testacc
. You have to export yourOFFLINE_TOKEN
variable first.