-
Notifications
You must be signed in to change notification settings - Fork 59
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
better developer experience: ability to run tests inside docker containers #126
base: master
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
FROM openvswitch/ovn:2.12_e60f2f2_debian_master | ||
|
||
ARG GOVERPKG=go1.13.9.linux-amd64.tar.gz | ||
RUN apt-get update | ||
RUN apt-get install -y wget git gcc python3-pip python3-dev build-essential autoconf automake libtool | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. what's the purpose of installing the tools such as gcc, python, build-essential, etc.? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. The test.sh script in the There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. but according to the steps you put in README, the test.sh script is not used. Your approach is supposed to run "go test" directly. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. The README captures the native |
||
|
||
RUN wget -P /tmp https://dl.google.com/go/$GOVERPKG | ||
|
||
RUN tar -C /usr/local -xzf /tmp/$GOVERPKG | ||
RUN rm /tmp/$GOVERPKG | ||
|
||
ENV GOPATH /go | ||
ENV PATH $GOPATH/bin:/usr/local/go/bin:$PATH | ||
RUN mkdir -p "$GOPATH/src" "$GOPATH/bin" && chmod -R 777 "$GOPATH" | ||
|
||
WORKDIR $GOPATH | ||
|
||
RUN apt-get install -y supervisor | ||
COPY supervisord.conf /etc/supervisor/conf.d/supervisord.conf | ||
|
||
ENTRYPOINT ["/usr/bin/supervisord"] |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
- Goal: Add ability to run the go-ovn tests inside of a docker container which in turn would make it easy to run on | ||
non-linux systems that have docker installed. The docker image installs `go` binaries and sets the `GOPATH` environment | ||
variable. | ||
|
||
- To build the docker image execute the below on a system where docker is installed | ||
|
||
```docker build -t <image_name>:<tag_name> .``` | ||
|
||
- To execute the tests, | ||
a)first, mount the path to the go-ovn repo when running the container as below: | ||
|
||
``` | ||
docker run -itd -v <PATH_TO_GO_OVN_REPO>:/go/src/github.com/eBay/go-ovn <image_name>:<tag_name> | ||
``` | ||
|
||
b)next, exec into shell of the running container ( `docker exec -it <running_container_name> bash`) and execute the | ||
below command to run the tests | ||
|
||
``` | ||
OVS_RUNDIR=/var/run/ovn OVN_NB_DB=unix:ovnnb_db.sock OVN_SB_DB=unix:ovnsb_db.sock go test -v ./... | ||
``` |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
[supervisord] | ||
nodaemon=true | ||
|
||
[program:ovn-nb-tcp] | ||
command=/bin/start-ovn ovn-nb-tcp | ||
|
||
[program:ovn-sb-tcp] | ||
command=/bin/start-ovn ovn-sb-tcp | ||
|
||
[program:ovn-northd-tcp] | ||
command=/bin/start-ovn ovn-northd-tcp | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. It seems we don't need northd for go-ovn testing. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. correct, but convenient to have a running container built from this image that has all the relevant services running |
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.
2.12 is rather old version, before OVS and OVN split.
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 used that image as the starting point as it was available in dockerhub at https://hub.docker.com/search?q=openvswitch%2Fovn&type=image, I am hoping that OVN images get regulary pushed as per the request at ovn-org/ovn#67 This dockerfile can be updated once the OVN release images gets published regularly, what do you think?