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

Facilitate local unit tests #121

Merged
merged 4 commits into from
Jan 19, 2021
Merged

Facilitate local unit tests #121

merged 4 commits into from
Jan 19, 2021

Conversation

amorenoz
Copy link
Contributor

While doing some changes to go-ovn I wanted to have a quick and isolated way to run the go-ovn unit tests (instead of relying on travis or having to do a lot of preliminary setup). So I ended up reusing the travis scripts to have a container-isolated local Makefile.

The result is that, running make check will build a container (only the first time you run it) and run the unit tests using the same scripts travis.

Sending this PR as a request for comments. Is something like this considered useful?

Currently ovn and ovs are checked out in under `pwd`.
This is fine for a one-off build such as the one travis does. But for
for if we wanted to reuse the ovs build for many tests while keeping the
working directory clean, this is not enough

In order to support sharing ovs builds between tests, support selecting
the ovn/ovn build directory from the outside.

Signed-off-by: Adrian Moreno <amorenoz@redhat.com>
@hzhou8
Copy link
Contributor

hzhou8 commented Dec 22, 2020

Thanks @amorenoz . Yes, this is looks very reasonable and useful. What's the work pending (I am asking since it is marked as RFC)?

@amorenoz
Copy link
Contributor Author

@hzhou8 I marked as RFC because I was not sure if it would be considered useful. If it is, I think it's ready for review

@amorenoz amorenoz changed the title RFC: Facilitate local unit tests Facilitate local unit tests Dec 22, 2020
.travis/test_prepare.sh Outdated Show resolved Hide resolved
.travis/test_run.sh Show resolved Hide resolved
Makefile Show resolved Hide resolved
.travis/test_prepare.sh Outdated Show resolved Hide resolved
@hzhou8
Copy link
Contributor

hzhou8 commented Jan 14, 2021

LGTM now except the minor typo. @amorenoz let me know you want to push once again. Thanks a lot.

@vtolstov would you take a look?

@vtolstov
Copy link
Contributor

ok for me, minor typos in wording

Signed-off-by: Adrian Moreno <amorenoz@redhat.com>
Use a container to isolate from other ovsdb instances

Signed-off-by: Adrian Moreno <amorenoz@redhat.com>
This significantly speeds up test execution

Signed-off-by: Adrian Moreno <amorenoz@redhat.com>
@vjayaramrh
Copy link
Contributor

@amorenoz if I wanted to execute 'go test -v ./...' or run a single test such as 'go test -run TestLogicalRouterPort' (refer https://github.com/eBay/go-ovn/blob/master/logical_router_port_test.go#L10), how would I be able to do that? Thanks

@hzhou8
Copy link
Contributor

hzhou8 commented Jan 19, 2021

@amorenoz if I wanted to execute 'go test -v ./...' or run a single test such as 'go test -run TestLogicalRouterPort' (refer https://github.com/eBay/go-ovn/blob/master/logical_router_port_test.go#L10), how would I be able to do that? Thanks

@vjayaramrh I think the test_run.sh script can be further improved to provide an option to run a specific test case. With this we can use "docker run ... sh" to start the container and execute the test_run.sh script for specific test cases.

I will merge this PR now since it would already provide lots of conveniences. More improvements are welcome :)

@hzhou8 hzhou8 merged commit 69e121b into eBay:master Jan 19, 2021
@amorenoz
Copy link
Contributor Author

@vjayaramrh, although it's possible to run your own "docker run" command, we could make it easier by adding an option, like @hzhou8 mentions, or even my documenting that process. WDYT?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants