28 Commits

Author SHA1 Message Date
Gabe Rosenhouse
deb4466041 versioning: adds tooling to compile a program against a given old CNI version
Allows us to write tests that cover interactions between components of
differing versions
2016-09-02 16:02:02 -04:00
Gabe Rosenhouse
536cb5b99b versioning: plugins report a list of supported versions
Further progress on versioning support (Issue #266).
Bump CNI spec version to 0.3.0
2016-09-02 11:26:17 -04:00
Lucas Käldström
fc58b79b45 build: Update the build script to make it possible to build for other architectures
This makes it possible to cross-compile cni like so:
$ GOARCH=arm ./build
$ GOARCH=arm64 ./build
$ GOARCH=ppc64le ./build

ref #209
2016-08-13 12:44:28 +03:00
Stefan Junker
8e1c215116 pkg/ip tests: cover SetupVeth and DelLinkByName* 2016-07-22 15:34:53 -07:00
Minhan Xia
1c1424c472 add tests for generateHardwardAddr 2016-07-22 15:01:57 -07:00
Gabe Rosenhouse
bacdc3668d libcni: add integration test coverage 2016-07-15 13:01:08 -07:00
Gabe Rosenhouse
5835c2bbb1 plugins: adds new no-op plugin that may be used as a test-double
Plugin can be configured to record all inputs and to respond with
arbitrary stdout or error message.  Will support upcoming integration
testing.
2016-07-15 12:48:02 -07:00
Pengfei Ni
cd14fc0e06 plugins/main/ptp: add functional tests 2016-07-11 09:25:36 +08:00
Minhan Xia
2445a960a9 plugins/ipam: round robin ip allocation for host-local ipam
This changes the ip allocation logic to round robin. Before this, host-local IPAM searched for available IPs from start of subnet. Hence it tends to allocate IPs that had been used recently. This is not ideal since it may cause collisions.
2016-06-02 20:37:05 +02:00
Stefan Junker
232d7c095d test: fix bash variable escaping in sudo command 2016-05-21 01:48:26 +02:00
Dan Williams
ebf83ffde5 bridge: add e2e testing 2016-05-20 17:10:25 -05:00
Dan Williams
552dc43168 macvlan: add e2e testing 2016-05-20 17:10:25 -05:00
Dan Williams
185e33ebe9 ipvlan: add e2e testing 2016-05-20 17:10:25 -05:00
Dan Williams
31da322f6e testutils: add e2e testing helper code 2016-05-20 17:10:25 -05:00
Dan Williams
c0d34c692f ns: add interface, use it, and fix thread-related namespace switch issues
Add a namespace object interface for somewhat cleaner code when
creating and switching between network namespaces.  All created
namespaces are now mounted in /var/run/netns to ensure they
have persistent inodes and paths that can be passed around
between plugin components without relying on the current namespace
being correct.

Also remove the thread-locking arguments from the ns package
per https://github.com/appc/cni/issues/183 by doing all the namespace
changes in a separate goroutine that locks/unlocks itself, instead of
the caller having to track OS thread locking.
2016-05-20 17:10:25 -05:00
Gabe Rosenhouse
dd3b85c9cc Add basic unit tests of testhelpers 2016-04-17 19:25:39 -07:00
Jonathan Boulle
f6135c7ba3 *: add missing license headers + check 2016-04-01 15:35:21 +02:00
Abhishek Chanda
c33daf6706 pkg: add a function to generate chain names
Adds a function to generate chain names for use in iptables and
ports all drivers to use that function. Also adds tests for the
said function.
2016-03-31 18:01:32 +02:00
Stefan Junker
8916a7ea5f pkg/types: add tests for args 2016-03-21 20:40:39 +01:00
Stefan Junker
a6c5d80661 pkg/skel: add rudimentary unit tests
This is an attempt to testing the PluginMain() function of the skel pkg.
We should be able to do better by using a mockable interface for the
plugins, but this is a start.
2016-03-18 22:34:29 +01:00
Gabe Rosenhouse
9356e23554 WithNetNS restores original namespace when callback errors
- adds test coverage of WithNetNS in BDD-style
2016-03-15 01:51:58 -07:00
Stefan Junker
c1ee5d00df travis & README: add coveralls coverage report
Also, don't use sudo for the entire test script
2016-03-05 19:07:31 +01:00
zachgersh
f3f999c20a Make sure invoke tests are running 2016-03-02 11:38:33 -05:00
Zachary Gershman
ebd5be8475 Adds ginkgo / gomega as a dependency 2016-02-29 12:27:11 -05:00
Alban Crequy
f49145d5ff new plugin: tuning
Allow users to tune net network parameters such as somaxconn.

With this patch, users can add a new network configuration:

> {
>   "name": "mytuning",
>   "type": "tuning",
>   "sysctl": {
>           "net.core.somaxconn": "500"
>   }
> }

The value /proc/sys/net/core/somaxconn will be set to 500 in the network
namespace but will remain unchanged on the host.

Only sysctl parameters that belong to the network subsystem can be
modified.

Related to: https://github.com/coreos/rkt/pull/2140
2016-02-18 15:29:12 +01:00
Stefan Junker
28d18d3e73 scripts: improve shebang compatibility 2016-01-27 10:31:16 +01:00
Michael Bridgen
b88f173c43 Factor an API out into a module
This takes some of the machinery from CNI and from the rkt networking
code, and turns it into a library that can be linked into go apps.

Included is an example command-line application that uses the library,
called `cnitool`.

Other headline changes:

 * Plugin exec'ing is factored out

The motivation here is to factor out the protocol for invoking
plugins. To that end, a generalisation of the code from api.go and
pkg/plugin/ipam.go goes into pkg/invoke/exec.go.

 * Move argument-handling and conf-loading into public API

The fact that the arguments get turned into an environment for the
plugin is incidental to the API; so, provide a way of supplying them
as a struct or saying "just use the same arguments as I got" (the
latter is for IPAM plugins).
2015-09-16 10:14:39 +01:00
Jonathan Boulle
d10d1a148e *: add basic test script + travis hook
Adds a simple test script, mostly to perform gofmt and govet checking;
currently tests only exist for the DHCP plugin.
2015-09-07 16:21:53 -07:00