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

Fixes broken local macOS build and completes migration to GH actions #160

Merged
merged 5 commits into from
Apr 6, 2021

Conversation

codefromthecrypt
Copy link
Contributor

@codefromthecrypt codefromthecrypt commented Apr 3, 2021

This fixes the broken macOS build and completes migration to GitHub
actions. This doesn't yet fix CI os/x build, as that will still be tracked in
#88.

Most notably, we have no control over process.OpenFiles, so this avoids
testing side-effects of that in Darwin, while mentioning the limitation.
If a future version of go supports that, the test will break (in a good
way!).

On the topic of CI, this moves the unit test and coverage part to GH
actions, and most importantly enables macOS matrix tests. This helps
give confidence for those not using macOS to review change such as
this.

See #88
Fixes #89
Fixes #100

@codefromthecrypt
Copy link
Contributor Author

I use OS/X and verified this works now. It will be very much more productive for me when this is in, because formerly I had to rely on CI to tell if all tests pass or not.

make test
go mod download
go generate ./pkg/...
docker-compose up -d
getenvoy_registry_1 is up-to-date
go test   ./pkg/...
?   	github.com/tetratelabs/getenvoy/pkg/binary	[no test files]
ok  	github.com/tetratelabs/getenvoy/pkg/binary/envoy	0.791s
ok  	github.com/tetratelabs/getenvoy/pkg/binary/envoy/controlplane	8.704s
ok  	github.com/tetratelabs/getenvoy/pkg/binary/envoy/debug	10.491s
?   	github.com/tetratelabs/getenvoy/pkg/binary/envoytest	[no test files]
ok  	github.com/tetratelabs/getenvoy/pkg/cmd	1.996s
ok  	github.com/tetratelabs/getenvoy/pkg/cmd/extension	3.009s
ok  	github.com/tetratelabs/getenvoy/pkg/cmd/extension/build	0.687s
ok  	github.com/tetratelabs/getenvoy/pkg/cmd/extension/clean	1.693s
?   	github.com/tetratelabs/getenvoy/pkg/cmd/extension/common	[no test files]
ok  	github.com/tetratelabs/getenvoy/pkg/cmd/extension/example	2.669s
?   	github.com/tetratelabs/getenvoy/pkg/cmd/extension/globals	[no test files]
ok  	github.com/tetratelabs/getenvoy/pkg/cmd/extension/init	2.327s
ok  	github.com/tetratelabs/getenvoy/pkg/cmd/extension/push	1.039s
ok  	github.com/tetratelabs/getenvoy/pkg/cmd/extension/run	7.637s
ok  	github.com/tetratelabs/getenvoy/pkg/cmd/extension/test	1.365s
?   	github.com/tetratelabs/getenvoy/pkg/common	[no test files]
?   	github.com/tetratelabs/getenvoy/pkg/errors	[no test files]
?   	github.com/tetratelabs/getenvoy/pkg/extension/example/init/registry	[no test files]
?   	github.com/tetratelabs/getenvoy/pkg/extension/example/init/registry/templates	[no test files]
ok  	github.com/tetratelabs/getenvoy/pkg/extension/init	0.371s
?   	github.com/tetratelabs/getenvoy/pkg/extension/init/templates	[no test files]
?   	github.com/tetratelabs/getenvoy/pkg/extension/manager	[no test files]
?   	github.com/tetratelabs/getenvoy/pkg/extension/wasmimage	[no test files]
?   	github.com/tetratelabs/getenvoy/pkg/extension/workspace	[no test files]
?   	github.com/tetratelabs/getenvoy/pkg/extension/workspace/config	[no test files]
?   	github.com/tetratelabs/getenvoy/pkg/extension/workspace/config/example	[no test files]
ok  	github.com/tetratelabs/getenvoy/pkg/extension/workspace/config/extension	0.227s
ok  	github.com/tetratelabs/getenvoy/pkg/extension/workspace/config/toolchain/builtin	0.477s
?   	github.com/tetratelabs/getenvoy/pkg/extension/workspace/example	[no test files]
ok  	github.com/tetratelabs/getenvoy/pkg/extension/workspace/example/envoy/template	0.313s
ok  	github.com/tetratelabs/getenvoy/pkg/extension/workspace/example/envoy/util	0.494s
?   	github.com/tetratelabs/getenvoy/pkg/extension/workspace/example/runtime	[no test files]
ok  	github.com/tetratelabs/getenvoy/pkg/extension/workspace/example/runtime/configdir	0.900s
ok  	github.com/tetratelabs/getenvoy/pkg/extension/workspace/example/runtime/getenvoy	4.389s
?   	github.com/tetratelabs/getenvoy/pkg/extension/workspace/fs	[no test files]
?   	github.com/tetratelabs/getenvoy/pkg/extension/workspace/model	[no test files]
ok  	github.com/tetratelabs/getenvoy/pkg/extension/workspace/toolchain	0.582s
ok  	github.com/tetratelabs/getenvoy/pkg/extension/workspace/toolchain/builtin	0.433s
?   	github.com/tetratelabs/getenvoy/pkg/extension/workspace/toolchain/registry	[no test files]
?   	github.com/tetratelabs/getenvoy/pkg/extension/workspace/toolchain/types	[no test files]
ok  	github.com/tetratelabs/getenvoy/pkg/flavors	0.303s
ok  	github.com/tetratelabs/getenvoy/pkg/flavors/postgres	0.196s
ok  	github.com/tetratelabs/getenvoy/pkg/manifest	0.347s
ok  	github.com/tetratelabs/getenvoy/pkg/pii	0.189s
?   	github.com/tetratelabs/getenvoy/pkg/test/cmd	[no test files]
?   	github.com/tetratelabs/getenvoy/pkg/test/manifest	[no test files]
ok  	github.com/tetratelabs/getenvoy/pkg/transport	0.274s
ok  	github.com/tetratelabs/getenvoy/pkg/types	0.221s
ok  	github.com/tetratelabs/getenvoy/pkg/util/args	0.284s
ok  	github.com/tetratelabs/getenvoy/pkg/util/cmd	0.261s
?   	github.com/tetratelabs/getenvoy/pkg/util/cmd/errors	[no test files]
?   	github.com/tetratelabs/getenvoy/pkg/util/docker	[no test files]
ok  	github.com/tetratelabs/getenvoy/pkg/util/exec	3.437s
?   	github.com/tetratelabs/getenvoy/pkg/util/io	[no test files]
ok  	github.com/tetratelabs/getenvoy/pkg/util/os	1.298s
?   	github.com/tetratelabs/getenvoy/pkg/util/scaffold	[no test files]
?   	github.com/tetratelabs/getenvoy/pkg/util/ui	[no test files]
ok  	github.com/tetratelabs/getenvoy/pkg/version	2.803s

@@ -32,42 +31,44 @@ import (
"github.com/tetratelabs/getenvoy/pkg/binary/envoytest"
)

func TestMain(m *testing.M) {
Copy link
Contributor Author

Choose a reason for hiding this comment

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

I moved this into the test preconditions as it isn't necessary to do this for anything in the package

// In a normal macOS setup, you cannot write to /dev/stdout, which is the default path here.
// While not Docker-specific, there are related notes here https://github.com/moby/moby/issues/31243
// Since this test doesn't read access logs anyway, the easier workaround is to disable access logging.
args.MeshConfig.AccessLogFile = ""
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Key fix for darwin is here, and when there's a better solution (than running as root or changing host perms), hopefully this comment explains enough.

require.NoError(t, err, "error stating %v", path)

if runtime.GOOS == `darwin` { // process.OpenFiles in unsupported, so this feature won't work
require.Empty(t, f.Size(), "file %v was not empty", path)
Copy link
Contributor Author

Choose a reason for hiding this comment

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

better to do a negative test than always fail osx builds

@codefromthecrypt codefromthecrypt force-pushed the fix-osx branch 2 times, most recently from 37e7961 to 49f81f9 Compare April 3, 2021 06:55
@codefromthecrypt codefromthecrypt changed the title Fixes broken macOS build Fixes broken macOS build and completes migration to GH actions Apr 3, 2021
@codefromthecrypt
Copy link
Contributor Author

circleci needs to be removed as a required check to merge this (we no longer use it)

strategy:
matrix:
runner:
- os: macos-latest
Copy link
Contributor Author

Choose a reason for hiding this comment

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

in circleci, we only tested ubuntu. this also tests macos which saves devs like me who use it. if this fails, we can assume dev workflow is busted.

@codefromthecrypt
Copy link
Contributor Author

E2E failures are unrelated as this doesn't change anything E2E related. It appears we hit docker.io rate limits again #149

@mathetake
Copy link
Member

@codefromthecrypt The macos test has never succeeded, and I must see that pass before merging.

@mathetake
Copy link
Member

looks like it's stuck somewhere in the tests.

@mathetake
Copy link
Member

I reproduced the same hang of test in my local mac (with the latest docker for mac on Catalina 10.15.7).

@codefromthecrypt
Copy link
Contributor Author

I have a hunch the hang is timeout related, our "unit tests" perform I/O, download envoy etc, it seems easy to get over 60s, especially in osx. I'll remove that for a job timeout especially until test migrations occur.

@codefromthecrypt
Copy link
Contributor Author

even though the macos build is fixed for me locally, I think it isn't quite working in CI. I'll un-tag this from fixing OS/X even if it is fine local. At any rate, this is progress from before as before even local didn't work. Once we migrate completely off ginkgo, it should be easier to identify what's wrong as timeouts will be coherent then.

@codefromthecrypt codefromthecrypt changed the title Fixes broken macOS build and completes migration to GH actions Fixes broken local macOS build and completes migration to GH actions Apr 6, 2021
@codefromthecrypt
Copy link
Contributor Author

not sure why GH actions fell of the checks, but this is the run https://github.com/tetratelabs/getenvoy/actions/runs/721808158

Adrian Cole added 5 commits April 6, 2021 16:24
Most notably, we have no control over process.OpenFiles, so this avoids
testing side-effects of that in Darwin, while mentioning the limitation.
If a future version of go supports that, the test will break (in a good
way!).

Signed-off-by: Adrian Cole <adrian@tetrate.io>
Signed-off-by: Adrian Cole <adrian@tetrate.io>
Signed-off-by: Adrian Cole <adrian@tetrate.io>
Signed-off-by: Adrian Cole <adrian@tetrate.io>
@codefromthecrypt codefromthecrypt deleted the fix-osx branch April 6, 2021 09:33
@codefromthecrypt
Copy link
Contributor Author

@mathetake fyi there might be some cleanup in circleci so that builds aren't attempted anymore on any branch

@mathetake mathetake mentioned this pull request Apr 6, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
2 participants