Skip to content
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

Add live tests #16

Merged
merged 2 commits into from
May 24, 2023
Merged

Add live tests #16

merged 2 commits into from
May 24, 2023

Conversation

heaths
Copy link
Owner

@heaths heaths commented May 24, 2023

Resolves #14

@heaths
Copy link
Owner Author

heaths commented May 24, 2023

@ellismg @savannahostrowski you might be interested in this. I discovered output variables are written to the .env file and was able to use that to load .env files to support live testing.

It was a bit of a surprise that when I ran azd down the .env file and its parent directory e.g., .azure/azcryptotmp, remained such that live tests would eventually time out. Should this environment directory be remoted when the environment is deprovisioned? Or is it retained for some scenarios? Since the RG and any resources are re-provisioned anew, I can't immediately fathom a reason to keep them but may be missing some scenarios.

@heaths heaths enabled auto-merge (squash) May 24, 2023 23:07
Need a naive solution for Go 1.18.
@heaths heaths merged commit 3c63971 into main May 24, 2023
@heaths heaths deleted the issue14 branch May 24, 2023 23:56
@ellismg
Copy link

ellismg commented May 25, 2023

Should this environment directory be remoted when the environment is deprovisioned? Or is it retained for some scenarios? Since the RG and any resources are re-provisioned anew, I can't immediately fathom a reason to keep them but may be missing some scenarios.

I guess we just always thought of destroying the infrastructure of the environment as a separate operation from deleting the environment itself. We have seen cases where folks with azd down and then azd up again, in the same environment, perhaps after making some modifications to AZURE_LOCATION (this is common where the initial location you pick is at capacity).

We do remove any outputs that were written to the .env file due to bicep outputs from the .env file when you run azd down. There was a bug where that was not happing for a period of time, but it was fixed for the 1.0.0 release. You could use this behavior, in combination with a sentinel output in your main.bicep to detect this case, perhaps?

@heaths
Copy link
Owner Author

heaths commented May 25, 2023

By sentinel output, do you mean like some file to note whether the system is provisioned (or at least that up was run) or not (or that at least down was run, likely the absence of said sentinel)? Yeah, possibly. I was hoping to avoid implementation details and just rely on any .env file.

That said, if you remove outputs I could probably use that i.e., os.Getenv("AZURE_KEYVAULT_URL") would return "" so I could assume the system isn't currently provisioned.

That said, that you leave inputs (params) in the .env file, does that mean for your default / current environment, you also read that environment's .env file in as subsequent input? Interesting.

@ellismg
Copy link

ellismg commented May 25, 2023

That said, if you remove outputs I could probably use that i.e., os.Getenv("AZURE_KEYVAULT_URL") would return "" so I could assume the system isn't currently provisioned.

Yeah - this is what I had in mind. If there was not already a value in the .env that you could have used for this purpose, I would have said you could add an output like "output WAS_PROVISIONED boolean = true` and then do an os.Getenv on that.

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.

Support live tests
2 participants