-
Notifications
You must be signed in to change notification settings - Fork 118
Fix docker local tests to be compatible with newer versions of pg image #3047
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
Conversation
2000450
to
36bf561
Compare
@@ -61,14 +85,9 @@ func TestChefClientAuthn(t *testing.T) { | |||
t.Fatalf("parse test upstream URL %+v: %v", upstream, err) | |||
} | |||
|
|||
pgURLGiven := false | |||
pgCfg := pg.Config{ | |||
PGURL: constants.TestPgURL, |
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.
is this what was passing the postgres
user? 🤔
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.
Yep
t.Fatalf("opening connector: %s", err) | ||
} else { | ||
t.Logf("opening database: %s", err) | ||
t.Logf(testconstants.SkipPGMessageFmt, pgCfg.PGURL) | ||
t.Logf("failed to open test database with PG_URL: %q", pgCfg.PGURL) |
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.
These subsequent logs seem confusing-- if we know we're going to log a failure, why log the attempt?
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 think we are just logging the error and the URL it failed with?
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.
Could be more clear though. Open to whatever.
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.
We hit this line if the PG_URL
wasn't provided, right? Can we log that and indicate that we are skipping pg tests (something more akin to the old message)?
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.
Basically I would be led astray by the word "failed"
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.
Yeah same
@@ -50,11 +50,11 @@ test: | |||
|
|||
test_with_db: | |||
@docker ps | grep authn-postgres || (echo "Docker postgres not up. Run 'make setup_docker_pg' and try this command again."; exit 1) | |||
@PG_URL="postgresql://[email protected]:5432/authn_test?sslmode=disable&timezone=UTC" go test -cover -count=1 -parallel=1 -p 1 $(packages) | |||
@PGTZ=UTC PG_URL="postgresql://[email protected]:5432/authn_test?sslmode=disable&password=docker" go test -cover -count=1 -parallel=1 -p 1 $(packages) |
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.
any idea what the timezone parameter was doing for us?
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.
Oh I see you've moved it above 🤔
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.
Would like a message explaining the skipping/jogging my old brain about how to change the skipping
// | ||
// Yes those lines are long, but if we linebreak, the output ends up starting | ||
// with TAB characters, which makes it harder to copy-paste the commands. | ||
const SkipPGMessageFmt = ` |
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.
Like @blakestier was saying, this is a much more actionable error message. Do we need to remove it?
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.
don't think that's what we want people to do? this made sense when we weren't automating with the makefile.
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.
👍 👍 thanks for digging into this!
36bf561
to
cf091f4
Compare
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.
Works for me--after rebasing to latest master. (The recent golang bump to 1.14 caused a problem, but rebasing fixed it for me.)
$ make test_with_db
. . .
go: inconsistent vendoring in /Users/msorens/code/go/src/github.com/chef/automate:
golang.org/x/[email protected]: is explicitly required in go.mod, but vendor/modules.txt indicates golang.org/x/[email protected]
Recently, the docker image's default security config was changed because it defaulted to super insecure settings: docker-library/postgres#580 We didn't care about that since we were only using it locally for testing. Updating the Makefiles for auth related services to work with newer versions of the docker postgres image. Also cleaned up some of authn's use of PG_URL so there was less inconsistency and hard-codedness. Signed-off-by: Tyler Cloke <[email protected]>
cf091f4
to
2027968
Compare
🔩 Description: What code changed, and why?
Recently, the docker image's default security config was changed because it defaulted to super insecure settings:
docker-library/postgres#580
We didn't care about that since we were only using it locally for testing. Updating the Makefiles for auth related services to work with newer versions of the docker postgres image. Also cleaned up some of authn's use of PG_URL so there was less inconsistency and hard-codedness.
👟 How to Build and Test the Change
Get on the latest docker image:
In teams, authz, and authn services:
✅ Checklist