Skip to content
This repository has been archived by the owner on Jul 12, 2023. It is now read-only.

Use different envvars to trigger integration #1086

Merged
merged 1 commit into from
Oct 16, 2020
Merged

Conversation

sethvargo
Copy link
Member

I lost a few hours trying to debug why my tests were failing locally. DB_NAME is the envvar automatically set by the dev script, so that triggered the "integration test" path, except my local database already had data, leading to bizarre and very difficult to debug failures. This could have been worse - it's possible someone runs tests when connected to the production database.

This changes the environment variables to be prefixed with INTEGRATION_ to reduce the chances of such collisions.

/cc @chaodaiG

Release Note

Use different envvars to trigger integration tests

@google-cla google-cla bot added the cla: yes Auto: added by CLA bot when all committers have signed a CLA. label Oct 15, 2020
@google-oss-robot google-oss-robot added approved Auto: added by prow when enough reviewers approve. size/M Auto: Medium number of changes. labels Oct 15, 2020
@sethvargo sethvargo added the do-not-merge/hold Do not merge: held by author or reviewer. label Oct 15, 2020
@sethvargo
Copy link
Member Author

I think we also need to change something in the integration environment for this to work.

@google-oss-robot google-oss-robot added the lgtm Auto: added by prown with a reviewer LGTMs label Oct 16, 2020
@google-oss-robot
Copy link

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: mikehelmick, sethvargo

The full list of commands accepted by this bot can be found here.

The pull request process is described here

Needs approval from an approver in each of these files:
  • OWNERS [mikehelmick,sethvargo]

Approvers can indicate their approval by writing /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

@mikehelmick mikehelmick removed the approved Auto: added by prow when enough reviewers approve. label Oct 16, 2020
@mikehelmick
Copy link
Contributor

waiting for word on integration env changes

if v := os.Getenv("DB_NAME"); v != "" && !testing.Short() {
dbConfig := &database.Config{}
var db *database.DB
if v := os.Getenv("INTEGRATION_DB_NAME"); v != "" {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The logic inside this if clause uses DB_NAME env var for establishing database connection from e2e test, I would suggest change this if condition to be

Suggested change
if v := os.Getenv("INTEGRATION_DB_NAME"); v != "" {
if v := os.Getenv("RUN_E2E_TEST"); v != "" {

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Based on the discussion at google/exposure-notifications-verification-server#841 (comment), INTEGRATION_DB_NAME would work. Needs several additional changes at:


var bs storage.Blobstore
var err error
if v := os.Getenv("INTEGRATION_GOOGLE_CLOUD_BUCKET"); v != "" {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please also update this line:

export_terraform_output export_bucket GOOGLE_CLOUD_BUCKET

I lost a few hours trying to debug why my tests were failing locally. DB_NAME is the envvar automatically set by the dev script, so that triggered the "integration test" path, except my local database already had data, leading to bizarre and very difficult to debug failures. This could have been worse - it's possible someone runs tests when connected to the production database.

This changes the environment variables to be prefixed with E2E_ to reduce the chances of such collisions.
@google-oss-robot google-oss-robot added approved Auto: added by prow when enough reviewers approve. and removed lgtm Auto: added by prown with a reviewer LGTMs labels Oct 16, 2020
@sethvargo
Copy link
Member Author

@chaodaiG updated to prefix with E2E_- PTAnotherL

@chaodaiG
Copy link
Contributor

I think this'll work
/lgtm

@google-oss-robot google-oss-robot added the lgtm Auto: added by prown with a reviewer LGTMs label Oct 16, 2020
@chaodaiG
Copy link
Contributor

/unhold

@google-oss-robot google-oss-robot removed the do-not-merge/hold Do not merge: held by author or reviewer. label Oct 16, 2020
@google-oss-robot google-oss-robot merged commit 3df9d12 into main Oct 16, 2020
@google-oss-robot google-oss-robot deleted the sethvargo/sad branch October 16, 2020 21:12
@github-actions github-actions bot locked as resolved and limited conversation to collaborators Oct 17, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
approved Auto: added by prow when enough reviewers approve. cla: yes Auto: added by CLA bot when all committers have signed a CLA. lgtm Auto: added by prown with a reviewer LGTMs size/M Auto: Medium number of changes.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants