-
Notifications
You must be signed in to change notification settings - Fork 1.5k
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
fix(ci): resolve systest failures on arm #8503
Conversation
d258c24
to
567acb6
Compare
This looks good 👍 - ill merge it tomorrow! I want a review by @anurags92 here as well ... |
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 have added my observations on the pull request. Let me know if you find them useful.
@@ -0,0 +1,97 @@ | |||
# Auto-generated with: [./compose -a 3 -z 1 -r 1 --minio --minio_port=9001 --minio_env_file=../../backup.env -w --port_offset=0 --expose_ports=false --mem= --names=false -O ../systest/backup/minio-large/docker-compose.yml] |
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 don't think this is true anymore unless the compose.go
produces ${COVERAGE_OUTPUT}
as well in the command, which I doubt it would. Hence this should be removed to avoid misleading someone.
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.
Agreed - it would be nice to eventually use compose.go but for now I modify this line
--security "whitelist=10.0.0.0/8,172.16.0.0/12,192.168.0.0/16;" | ||
--tls "ca-cert=/dgraph-tls/ca.crt; server-cert=/dgraph-tls/node.crt; server-key=/dgraph-tls/node.key; internal-port=true; client-cert=/dgraph-tls/client.alpha3.crt; client-key=/dgraph-tls/client.alpha3.key;" | ||
minio: | ||
image: minio/minio:RELEASE.2020-11-13T20-10-18Z-arm64 |
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.
How about passing in the image as an environment variable?
docker-compose.yml
:
// Minio has two different images for arm and amd etc.. (descriptive comment in the docker yml)
minio:
image: ${MINIO_IMAGE_FOR_PLATFORM}
And in the t.go you can set the environment variable. Probably here: https://github.com/dgraph-io/dgraph/blob/035f9fc46221b3a465a42c291e3bef73d831d2cc/t/t.go#L100
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.
This is a very nice solution... I wasn't sure if this was possible, so thank you for confirming it in your PR! I just updated this PR.
@@ -0,0 +1,97 @@ | |||
# Auto-generated with: [./compose -a 3 -z 1 -r 1 --minio --minio_port=9001 --minio_env_file=../../backup.env -w --port_offset=0 --expose_ports=false --mem= --names=false -O ../systest/backup/minio/docker-compose.yml] |
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.
Same comment as 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.
Done
command: /gobin/dgraph ${COVERAGE_OUTPUT} zero --raft "idx=1;" --my=zero1:5080 --replicas=1 --logtostderr -v=2 --bindall | ||
--tls "ca-cert=/dgraph-tls/ca.crt; server-cert=/dgraph-tls/node.crt; server-key=/dgraph-tls/node.key; internal-port=true; client-cert=/dgraph-tls/client.zero1.crt; client-key=/dgraph-tls/client.zero1.key;" | ||
minio: | ||
image: minio/minio:RELEASE.2020-11-13T20-10-18Z-arm64 |
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.
Same comment as 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.
Done
@@ -0,0 +1,94 @@ | |||
# Auto-generated with: [./compose -l -a 3 -z 1 -r 1 --alpha_volume data:/data --minio --minio_port=9001 --minio_env_file=export.env --port_offset=0 --expose_ports=false --alpha_env_file=export.env --mem= --names=false -O ../systest/export/docker-compose.yml] |
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.
Same as 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.
Done
-v=2 | ||
--security "whitelist=10.0.0.0/8,172.16.0.0/12,192.168.0.0/16;" | ||
minio: | ||
image: minio/minio:RELEASE.2020-11-13T20-10-18Z-arm64 |
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.
Same as 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.
Done
t/t.go
Outdated
@@ -95,6 +95,7 @@ var ( | |||
"comma separated list of packages that needs to be skipped. "+ | |||
"Package Check uses string.Contains(). Please check the flag carefully") | |||
runCoverage = pflag.Bool("coverage", false, "Set true to calculate test coverage") | |||
arch = pflag.String("arch", "x86", "Machine architecture (required for systest/export test)") |
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.
Add comment on which values it accepts. eg. Valid values: [arm, x86 etc.]
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.
done
Wanted to test if the changes I proposed would work: #8508. cc: @joshua-goldstein @skrdgraph |
I was also wondering if the environment variable would get substituted at the appropriate time... Looks like it works fine. Thanks for the idea and testing it! I've updated this PR. |
@joshua-goldstein we can remove architecture flag and let the |
So sometime like a |
Another small comment which came up during the code review call, we can define default values for docker variables used in yml files. See: https://stackoverflow.com/questions/70772517/docker-compose-env-default-with-fallback Should we use that and insert a different value only for ARM? (Apologies for a separate comment, should have added this earlier but forgot). |
Also a good catch - what I did was add a default value now, so if the environment variable is not set it will use the previously used tag (see docs here). |
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 Joshua! Looks good to me.
## Problem Systest/export backup to minio was failing on arm64. ## Solution The minio image that we require was published before multi-architecture docker images were introduced. As such, there are two tags, namely `RELEASE.2020-11-13T20-10-18Z` (which we currently use for systest/export) and `RELEASE.2020-11-13T20-10-18Z-arm64` (which is required for arm64). See the Dockerhub page [here](https://hub.docker.com/r/minio/minio/tags?page=1&name=RELEASE.2020-11-13T20-10-18Z). Unfortunately docker-compose files do not offer some sort of conditional logic. As such the easiest way to use this image is to create a new docker-compose-arm64.yml file and a flag that specifies when it should be uses at the t.go level. This is not so elegant but is the easiest solution currently since we lack a way to dynamically generate docker-compose files. This PR also improves some testing functionality. In brief, all that is required to run tests now is to run `make test` from the root dgraph directory. If one wants to run specific package tests (e.g. systest/export) one can use `make test args="--pkg=systest/export"`. What this does is pass the `--pkg=systest/export` flag to the t.go binary when it is run. This has the benefit that any number of arguments can be passed to t.go. E.g., in the process of testing this PR, I ran ``` make test args="--pkg=systest/export --arch=arm64" ``` which (after building the dgraph binary and making a dgraph docker image with local tag) builds t.go and executes `./t --pkg=systest/export --arch-arm64` Finally, we fix a logic error that was introduced recently in t.go. Coverage files should only be copied over when t.go is run in coverage mode.
Problem
Systest/export backup to minio was failing on arm64.
Solution
The minio image that we require was published before multi-architecture docker images were introduced. As such, there are two tags, namely
RELEASE.2020-11-13T20-10-18Z
(which we currently use for systest/export) andRELEASE.2020-11-13T20-10-18Z-arm64
(which is required for arm64). See the Dockerhub page here.Unfortunately docker-compose files do not offer some sort of conditional logic. As such the easiest way to use this image is to create a new docker-compose-arm64.yml file and a flag that specifies when it should be uses at the t.go level. This is not so elegant but is the easiest solution currently since we lack a way to dynamically generate docker-compose files.
This PR also improves some testing functionality. In brief, all that is required to run tests now is to run
make test
from the root dgraph directory. If one wants to run specific package tests (e.g. systest/export) one can usemake test args="--pkg=systest/export"
. What this does is pass the--pkg=systest/export
flag to the t.go binary when it is run. This has the benefit that any number of arguments can be passed to t.go. E.g., in the process of testing this PR, I ranwhich (after building the dgraph binary and making a dgraph docker image with local tag) builds t.go and executes
./t --pkg=systest/export --arch-arm64
Finally, we fix a logic error that was introduced recently in t.go. Coverage files should only be copied over when t.go is run in coverage mode.