plugins.git
8 years agoFix testings accross the project
Pengfei Ni [Wed, 3 May 2017 15:21:44 +0000 (23:21 +0800)]
Fix testings accross the project

Signed-off-by: Pengfei Ni <feiskyer@gmail.com>
8 years agoAdd cniVersion to Result
Pengfei Ni [Wed, 3 May 2017 13:38:28 +0000 (21:38 +0800)]
Add cniVersion to Result

Signed-off-by: Pengfei Ni <feiskyer@gmail.com>
8 years agospec/plugins: fix 'ip'->'ips' in the spec, bump to 0.3.1
Dan Williams [Wed, 22 Mar 2017 19:21:53 +0000 (14:21 -0500)]
spec/plugins: fix 'ip'->'ips' in the spec, bump to 0.3.1

8 years agoplugins/*: Don't error if the device doesn't exist
Tom Denham [Mon, 20 Mar 2017 22:49:35 +0000 (15:49 -0700)]
plugins/*: Don't error if the device doesn't exist

I wasn't able to test or update the dhcp plugin but from a code read it
should be fine. All the other plugins are tested and fixed

8 years agopkg/ip: improve docstring for SetupVeth
Gabe Rosenhouse [Mon, 13 Mar 2017 18:27:12 +0000 (11:27 -0700)]
pkg/ip: improve docstring for SetupVeth

8 years agopkg/ip: SetupVeth returns net.Interface
Gabe Rosenhouse [Fri, 10 Mar 2017 17:49:46 +0000 (09:49 -0800)]
pkg/ip: SetupVeth returns net.Interface

8 years agopkg/ip: do not leak types from vendored netlink package
Jay Dunkelberger [Thu, 9 Mar 2017 21:55:15 +0000 (13:55 -0800)]
pkg/ip: do not leak types from vendored netlink package

The exported function SetupVeth now returns a package-defined type.

Signed-off-by: Gabe Rosenhouse <grosenhouse@pivotal.io>
8 years agospec,libcni: add support for injecting runtimeConfig into plugin stdin data
Dan Williams [Fri, 17 Feb 2017 04:57:12 +0000 (22:57 -0600)]
spec,libcni: add support for injecting runtimeConfig into plugin stdin data

Add a new CapabilityArgs member to the RuntimeConf struct which runtimes can
use to pass arbitrary capability-based keys to the plugin.  Elements of this
member will be filtered against the plugin's advertised capabilities (from
its config JSON) and then added to a new "runtimeConfig" top-level map added
to the config JSON sent to the plugin on stdin.

Also "runtime_config"->"runtimeConfig" in CONVENTIONS.md to make
capitalization consistent with other CNI config keys like "cniVersion".

8 years agoMerge pull request #383 from dcbw/test-fixes
Dan Williams [Mon, 27 Feb 2017 22:13:45 +0000 (16:13 -0600)]
Merge pull request #383 from dcbw/test-fixes

tests: misc test fixes

8 years agopkg/types: misc current types testcase cleanups
Dan Williams [Mon, 27 Feb 2017 19:28:07 +0000 (13:28 -0600)]
pkg/types: misc current types testcase cleanups

8 years agopkg/testutils: return errors after restoring stdout
Dan Williams [Mon, 27 Feb 2017 19:27:19 +0000 (13:27 -0600)]
pkg/testutils: return errors after restoring stdout

Ensures Ginkgo is able to print detailed failure messages instead
of them being captured by the pipe.

8 years agopkg/ip: refactored so that builds succeed on non-linux platforms
Aithal [Thu, 23 Feb 2017 17:52:13 +0000 (09:52 -0800)]
pkg/ip: refactored so that builds succeed on non-linux platforms

moved functions that depend on linux packages into a separate file and added
nop methods with a build tag for non-linux platforms in a new file.

8 years agopkg/ns, pkg/types: refactored non linux build fix code to
Aithal [Thu, 23 Feb 2017 17:50:48 +0000 (09:50 -0800)]
pkg/ns, pkg/types: refactored non linux build fix code to

Make GetCurrentNS platform specific instead of getCurrentThreadNetNSPath

8 years agopkg/ns: refactored so that builds succeed on non-linux platforms
Aithal [Sat, 18 Feb 2017 01:04:53 +0000 (17:04 -0800)]
pkg/ns: refactored so that builds succeed on non-linux platforms

moved functions that depend on linux packages (sys/unix) into a separate file
and added nop methods with a build tag for non-linux platforms in a new file.

8 years agoMerge pull request #361 from ofiliz/issue-360
Gabe Rosenhouse [Wed, 8 Feb 2017 18:15:49 +0000 (10:15 -0800)]
Merge pull request #361 from ofiliz/issue-360

invoke: Enable plugin file names with extensions

8 years agoinvoke: Enable plugin file names with extensions
Onur Filiz [Sat, 4 Feb 2017 20:01:47 +0000 (12:01 -0800)]
invoke: Enable plugin file names with extensions

A CNI network configuration file contains the plugin's executable file name.
Some platforms like Windows require a file name extension for executables.
This causes unnecessary burden on admins as they now have to maintain two
versions of each type of netconfig file, which differ only by the ".exe"
extension. A much simpler design is for invoke package to also look for
well-known extensions on platforms that require it. Existing tests are
improved and new tests are added to cover the new behavior.

Fixes #360

8 years agopkg/utils/sysctl/sysctl_linux.go: fix typo.
Paulo Pires [Fri, 3 Feb 2017 04:47:43 +0000 (04:47 +0000)]
pkg/utils/sysctl/sysctl_linux.go: fix typo.

8 years agopkg/utils/sysctl/sysctl_linux.go: fix build tag.
Paulo Pires [Fri, 3 Feb 2017 04:46:55 +0000 (04:46 +0000)]
pkg/utils/sysctl/sysctl_linux.go: fix build tag.

8 years agospec, libcni, pkg/invoke: Use OS-agnostic separator when parsing CNI_PATH
Onur [Sat, 28 Jan 2017 21:30:00 +0000 (13:30 -0800)]
spec, libcni, pkg/invoke: Use OS-agnostic separator when parsing CNI_PATH

Hardcoding the list separator character as ":" causes CNI to fail when parsing
CNI_PATH on other operating systems. For example, Windows uses ";" as list
separator because ":" can legally appear in paths such as "C:\path\to\file".
This change replaces use of ":" with OS-agnostic APIs or os.PathListSeparator.

Fixes #358

8 years agospec/plugins: return interface details and multiple IP addresses to runtime
Dan Williams [Tue, 22 Nov 2016 17:32:35 +0000 (11:32 -0600)]
spec/plugins: return interface details and multiple IP addresses to runtime

Updates the spec and plugins to return an array of interfaces and IP details
to the runtime including:

- interface names and MAC addresses configured by the plugin
- whether the interfaces are sandboxed (container/VM) or host (bridge, veth, etc)
- multiple IP addresses configured by IPAM and which interface they
have been assigned to

Returning interface details is useful for runtimes, as well as allowing
more flexible chaining of CNI plugins themselves.  For example, some
meta plugins may need to know the host-side interface to be able to
apply firewall or traffic shaping rules to the container.

8 years agopkg/ipam: add testcases
Dan Williams [Thu, 19 Jan 2017 14:44:35 +0000 (08:44 -0600)]
pkg/ipam: add testcases

8 years agomacvlan/ipvlan: use common RenameLink method
Dan Williams [Mon, 28 Nov 2016 15:33:39 +0000 (09:33 -0600)]
macvlan/ipvlan: use common RenameLink method

8 years agotypes: make Result an interface and move existing Result to separate package
Dan Williams [Wed, 9 Nov 2016 21:11:18 +0000 (15:11 -0600)]
types: make Result an interface and move existing Result to separate package

8 years agotestutils: pass netConf in for version operations; pass raw result out for tests
Dan Williams [Tue, 22 Nov 2016 16:02:39 +0000 (10:02 -0600)]
testutils: pass netConf in for version operations; pass raw result out for tests

8 years agoskel: adds PluginMainWithError which returns a *types.Error
Gabe Rosenhouse [Mon, 23 Jan 2017 00:39:15 +0000 (16:39 -0800)]
skel: adds PluginMainWithError which returns a *types.Error

Enables plugins to do their own error-handling and cleanup logic

8 years agoapi,libcni: add network config list-based plugin chaining
Dan Williams [Sat, 17 Dec 2016 00:56:39 +0000 (18:56 -0600)]
api,libcni: add network config list-based plugin chaining

Using a new ".configlist" file format that allows specifying
a list of CNI network configurations to run, add new libcni
helper functions to call each plugin in the list, injecting
the overall name, CNI version, and previous plugin's Result
structure into the configuration of the next plugin.

9 years agoall: assert internal objects implement interfaces
Dan Williams [Wed, 14 Dec 2016 23:09:01 +0000 (17:09 -0600)]
all: assert internal objects implement interfaces

9 years agoExpand description of goroutine+netns problems
Bryan Boreham [Thu, 17 Nov 2016 15:45:38 +0000 (15:45 +0000)]
Expand description of goroutine+netns problems

9 years agotesting: test invocation of newer plugins with an older libcni
Casey Callendrello [Fri, 14 Oct 2016 14:38:32 +0000 (16:38 +0200)]
testing: test invocation of newer plugins with an older libcni

9 years agoskel tests: correct name of CNI_CONTAINERID in tests of env vars
Gabe Rosenhouse [Mon, 17 Oct 2016 00:18:57 +0000 (17:18 -0700)]
skel tests: correct name of CNI_CONTAINERID in tests of env vars

9 years agotesting: adds basic test of backwards compatibility
Gabe Rosenhouse [Mon, 3 Oct 2016 04:43:51 +0000 (21:43 -0700)]
testing: adds basic test of backwards compatibility

9 years agoskel: use named constant for Incompatible CNI Version error code
Gabe Rosenhouse [Mon, 19 Sep 2016 20:14:02 +0000 (13:14 -0700)]
skel: use named constant for Incompatible CNI Version error code

9 years agoversioning: plugins require version match with config
Gabe Rosenhouse [Mon, 19 Sep 2016 20:00:49 +0000 (13:00 -0700)]
versioning: plugins require version match with config

infer version 0.1.0 when config is missing an explicit "cniVersion" field

9 years agoversioning: add basic version decode for network config
Gabe Rosenhouse [Mon, 19 Sep 2016 04:56:17 +0000 (21:56 -0700)]
versioning: add basic version decode for network config

9 years agoskel: Plugins require a cniVersion in the NetConf
Gabe Rosenhouse [Wed, 7 Sep 2016 00:19:26 +0000 (20:19 -0400)]
skel: Plugins require a cniVersion in the NetConf

9 years agoversioning: revert spec version to 0.2.0
Gabe Rosenhouse [Tue, 6 Sep 2016 19:24:12 +0000 (15:24 -0400)]
versioning: revert spec version to 0.2.0

9 years agoversioning: misc cleanups
Gabe Rosenhouse [Tue, 6 Sep 2016 15:22:27 +0000 (11:22 -0400)]
versioning: misc cleanups

highlights:
 - NetConf struct finally includes cniVersion field
 - improve test coverage of current version report behavior
 - godoc a few key functions
 - allow tests to control version list reported by no-op plugin

9 years agoinvoke: better name and unit test coverage for GetVersionInfo
Gabe Rosenhouse [Fri, 2 Sep 2016 20:39:01 +0000 (16:39 -0400)]
invoke: better name and unit test coverage for GetVersionInfo

9 years agoinvoke: correctly infer version for 0.1.0-vintage plugins
Gabe Rosenhouse [Fri, 2 Sep 2016 20:01:22 +0000 (16:01 -0400)]
invoke: correctly infer version for 0.1.0-vintage plugins

Older plugins return a known error when issued the VERSION command.
Capture this error and report it as a 0.1.0 version plugin.

9 years agoversioning: adds tooling to compile a program against a given old CNI version
Gabe Rosenhouse [Wed, 24 Aug 2016 05:57:00 +0000 (22:57 -0700)]
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

9 years agopkg/invoke: refactor plugin exec and backfill unit tests
Gabe Rosenhouse [Fri, 2 Sep 2016 17:12:14 +0000 (13:12 -0400)]
pkg/invoke: refactor plugin exec and backfill unit tests

9 years agoversioning: document meaning of 'Legacy' version support
Gabe Rosenhouse [Mon, 29 Aug 2016 23:20:18 +0000 (19:20 -0400)]
versioning: document meaning of 'Legacy' version support

9 years agoversioning: plugins report a list of supported versions
Gabe Rosenhouse [Mon, 22 Aug 2016 06:48:04 +0000 (23:48 -0700)]
versioning: plugins report a list of supported versions

Further progress on versioning support (Issue #266).
Bump CNI spec version to 0.3.0

9 years agoMerge pull request #293 from rosenhouse/backfill-invoke-exec-tests
Gabe Rosenhouse [Thu, 1 Sep 2016 00:49:08 +0000 (20:49 -0400)]
Merge pull request #293 from rosenhouse/backfill-invoke-exec-tests

Backfill tests for plugin execution

9 years agoMerge pull request #290 from asridharan/dcos
Dan Williams [Wed, 31 Aug 2016 23:19:02 +0000 (18:19 -0500)]
Merge pull request #290 from asridharan/dcos

Fixed the check for network namespace path.

9 years agopkg/ns: fixed the check for network namespace path.
Avinash Sridharan [Wed, 24 Aug 2016 23:49:50 +0000 (23:49 +0000)]
pkg/ns: fixed the check for network namespace path.

The expectation on older kernels (< 3.19) was to have the network
namespace always be a directory. This is not true if the network
namespace is bind mounted to a file, and will make the plugin fail
erroneously in such cases. The fix is to remove this assumption
completely and just do a basic check on the file system types being
returned.

Fixes #288

9 years agopkg/ip: Ensure that SetupVeth returns correct hostVeth
Tom Denham [Mon, 29 Aug 2016 21:10:36 +0000 (14:10 -0700)]
pkg/ip: Ensure that SetupVeth returns correct hostVeth

The veth is moved from the container NS to the host NS.
This is handled by the code that sets the link to UP but the wrong
hostVeth is returned to the calling code.

9 years agoinvoke: backfill tests for plugin execution
Gabe Rosenhouse [Wed, 31 Aug 2016 03:52:47 +0000 (23:52 -0400)]
invoke: backfill tests for plugin execution

9 years agoMerge pull request #267 from rosenhouse/version-cmd
Tom Denham [Fri, 12 Aug 2016 22:06:22 +0000 (15:06 -0700)]
Merge pull request #267 from rosenhouse/version-cmd

Adds VERSION command

9 years agopkg/ip: Return correct error if container name provided exists, and test cases
Prateek Gogia [Sun, 7 Aug 2016 19:24:56 +0000 (19:24 +0000)]
pkg/ip: Return correct error if container name provided exists, and test cases

If interface name for a container provided by a user is already present,
Veth creation fails with incorrect error.
If os.IsExist error is returned by makeVethPair:
* Check for peer name, if exists generate another random peer name,
* else, IsExist error is due to container interface present, return error.

Fixes #155

9 years agopkg/utils/hwaddr tests: cover v4 in v6 addr
Stefan Junker [Mon, 1 Aug 2016 23:50:40 +0000 (16:50 -0700)]
pkg/utils/hwaddr tests: cover v4 in v6 addr

9 years agopkg/ip link_test: ensure SetHWAddrByIP has an effect
Stefan Junker [Wed, 29 Jun 2016 19:13:37 +0000 (12:13 -0700)]
pkg/ip link_test: ensure SetHWAddrByIP has an effect

9 years agopkg/ip: use iface name in SetHWAddrByIP
Stefan Junker [Wed, 29 Jun 2016 19:13:05 +0000 (12:13 -0700)]
pkg/ip: use iface name in SetHWAddrByIP

9 years agopkg/ip tests: cover SetupVeth and DelLinkByName*
Stefan Junker [Wed, 29 Jun 2016 02:52:08 +0000 (19:52 -0700)]
pkg/ip tests: cover SetupVeth and DelLinkByName*

9 years agoplugins: set MAC addresses based on IP
Stefan Junker [Wed, 29 Jun 2016 00:46:17 +0000 (17:46 -0700)]
plugins: set MAC addresses based on IP

This will give deterministic MAC addresses for all interfaces CNI
creates and manages the IP for:
* bridge: container veth and host bridge
* macvlan: container veth
* ptp: container veth and host veth

9 years agopkg/utils/hwaddr: migrate code from IPAM pkg
Stefan Junker [Tue, 28 Jun 2016 19:51:58 +0000 (12:51 -0700)]
pkg/utils/hwaddr: migrate code from IPAM pkg

9 years agopkg/ipam{,test}: improve error handling and tests
Stefan Junker [Tue, 21 Jun 2016 23:28:38 +0000 (16:28 -0700)]
pkg/ipam{,test}: improve error handling and tests

* _suite.go and _test.go file should be in the same package, using the
  _test package for that, which requires some fields and methods to be
  exported
* Introduce error type for cleaner error handling
* test adaptions for error type checking

9 years agoadd tests for generateHardwardAddr
Minhan Xia [Tue, 3 May 2016 22:47:28 +0000 (15:47 -0700)]
add tests for generateHardwardAddr

9 years agoconfigure mac address based on assigned ip
Minhan Xia [Tue, 3 May 2016 19:03:05 +0000 (12:03 -0700)]
configure mac address based on assigned ip

9 years agoplugins: adds new no-op plugin that may be used as a test-double
Gabe Rosenhouse [Thu, 14 Jul 2016 20:59:10 +0000 (13:59 -0700)]
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.

9 years agomisc: fix up copyright dates
Gabe Rosenhouse [Thu, 14 Jul 2016 23:09:27 +0000 (16:09 -0700)]
misc: fix up copyright dates

9 years agopkg/skel: plugins now respond to VERSION command
Gabe Rosenhouse [Thu, 14 Jul 2016 03:50:54 +0000 (23:50 -0400)]
pkg/skel: plugins now respond to VERSION command

To support CNI spec versioning, plugins must be able to report version
information to container runtimes.

9 years agopkg/skel: improve error message for missing CNI_COMMAND env var
Gabe Rosenhouse [Thu, 14 Jul 2016 02:54:22 +0000 (22:54 -0400)]
pkg/skel: improve error message for missing CNI_COMMAND env var

This makes the error message for missing CNI_COMMAND consistent with
that of other required environment variables.

9 years agopkg/skel: missing env var log lines appear in stderr
Gabe Rosenhouse [Thu, 14 Jul 2016 02:24:34 +0000 (22:24 -0400)]
pkg/skel: missing env var log lines appear in stderr

Previously, the log lines appeared in stdout before the JSON encoding of
the error message.  That would break JSON parsing of stdout.  Instead, we use
stderr for these unstructured logs, consistent with the CNI spec.

9 years agopkg/skel: refactor to use dependency injection
Gabe Rosenhouse [Thu, 14 Jul 2016 02:12:06 +0000 (22:12 -0400)]
pkg/skel: refactor to use dependency injection

Extract dependencies on os to enable more complete unit test coverage

9 years agopkg/ns: fix misspelling in comment
Pengfei Ni [Tue, 14 Jun 2016 16:52:58 +0000 (00:52 +0800)]
pkg/ns: fix misspelling in comment

9 years agopkg/types: cover string for unmarshal tests
Stefan Junker [Mon, 6 Jun 2016 17:50:42 +0000 (19:50 +0200)]
pkg/types: cover string for unmarshal tests

9 years agopkg/types: Add UnmarshallableString type
Tom Denham [Wed, 1 Jun 2016 00:12:40 +0000 (17:12 -0700)]
pkg/types: Add UnmarshallableString type

Allow strings to be unmarshalled for CNI_ARGS

CNI_ARGS uses types.LoadArgs to populate a struct.
The fields in the struct must meet the TextUnmarshaler interface.

This code adds a UnmarshallableString type to assist with this.

9 years agopkg/ns: introduce error types indicate NS verification
Stefan Junker [Fri, 27 May 2016 09:52:44 +0000 (11:52 +0200)]
pkg/ns: introduce error types indicate NS verification

9 years agoskel/test: add case for empty NETNS
Stefan Junker [Fri, 27 May 2016 10:26:42 +0000 (12:26 +0200)]
skel/test: add case for empty NETNS

9 years agoplugins: don't require CNI_NETNS for DEL command
Stefan Junker [Fri, 27 May 2016 08:57:39 +0000 (10:57 +0200)]
plugins: don't require CNI_NETNS for DEL command

This will allow to free up the IPAM allocations when the caller doesn't
have access to the network namespace anymore, e.g. due to a reboot.

9 years agopkg/skel: allow arg requriements specified by CMD
Stefan Junker [Fri, 27 May 2016 08:56:24 +0000 (10:56 +0200)]
pkg/skel: allow arg requriements specified by CMD

9 years agopkg/ns: consider PROCFS during NS verification
Stefan Junker [Wed, 25 May 2016 21:49:25 +0000 (23:49 +0200)]
pkg/ns: consider PROCFS during NS verification

This is an attempt to bring compatibility with Kernel <3.19, where NSFS
where PROCFS was used for network namespaces.

9 years agopkg/ns: test IsNSFS()
Stefan Junker [Tue, 24 May 2016 20:30:01 +0000 (22:30 +0200)]
pkg/ns: test IsNSFS()

9 years agopkg/ns: test case for rejecting a non-ns nspath
Stefan Junker [Tue, 24 May 2016 20:21:57 +0000 (22:21 +0200)]
pkg/ns: test case for rejecting a non-ns nspath

9 years agopkg/ns: verify netns when initialized with GetNS
Stefan Junker [Tue, 24 May 2016 16:16:34 +0000 (18:16 +0200)]
pkg/ns: verify netns when initialized with GetNS

9 years agopkg/ns: add tests cases for Close()'d NS
Stefan Junker [Tue, 24 May 2016 18:48:12 +0000 (20:48 +0200)]
pkg/ns: add tests cases for Close()'d NS

9 years agopkg/ns: don't allow operations after Close()
Stefan Junker [Tue, 24 May 2016 18:27:18 +0000 (20:27 +0200)]
pkg/ns: don't allow operations after Close()

9 years agotestutils: add e2e testing helper code
Dan Williams [Tue, 29 Mar 2016 22:45:46 +0000 (17:45 -0500)]
testutils: add e2e testing helper code

9 years agons: add interface, use it, and fix thread-related namespace switch issues
Dan Williams [Tue, 5 Apr 2016 16:10:31 +0000 (11:10 -0500)]
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.

9 years agoMerge pull request #199 from dcbw/fix-bridge-tx-queue-length
Stefan Junker [Thu, 19 May 2016 21:05:08 +0000 (23:05 +0200)]
Merge pull request #199 from dcbw/fix-bridge-tx-queue-length

bridge: leave TX queue length as kernel default, not 0

9 years agoMerge pull request #200 from squaremo/simplify-readme
Michael Bridgen [Thu, 19 May 2016 12:21:40 +0000 (13:21 +0100)]
Merge pull request #200 from squaremo/simplify-readme

Simplify README preamble

9 years agopkg/ns: evaluate syscall number at compile-time
Angus Lees [Fri, 13 May 2016 07:32:40 +0000 (17:32 +1000)]
pkg/ns: evaluate syscall number at compile-time

Previously this code used a run-time map lookup keyed by
runtime.GOOS/GOARCH.  This version uses conditional compilation to make
this choice at compile time, giving immediate feedback for unsupported
platforms.

9 years agopkg/ns: use correct syscall number on arm
Angus Lees [Fri, 13 May 2016 07:18:39 +0000 (17:18 +1000)]
pkg/ns: use correct syscall number on arm

9 years ago*: appc/cni -> containernetworking/cni
Stefan Junker [Wed, 4 May 2016 14:06:05 +0000 (16:06 +0200)]
*: appc/cni -> containernetworking/cni

The project has been moved so internally we simply rename everything.
Consumers are recommended to update their vendored version of cni.

9 years agopkg/utils: add functions to work with sysctl
Piotr Skamruk [Mon, 7 Mar 2016 15:40:27 +0000 (16:40 +0100)]
pkg/utils: add functions to work with sysctl

9 years agoDocument use of goroutine and lockosthread in test helpers
Gabe Rosenhouse [Mon, 18 Apr 2016 03:27:02 +0000 (20:27 -0700)]
Document use of goroutine and lockosthread in test helpers

9 years agons: fix reading net namespace in multi-threaded processes
Dan Williams [Wed, 6 Apr 2016 16:03:31 +0000 (11:03 -0500)]
ns: fix reading net namespace in multi-threaded processes

/proc/self/ns/net gives the main thread's namespace, not necessarily
the namespace of the thread that's running the testcases.  This causes
sporadic failures of the tests.

For example, with a testcase reading inodes after switching netns:

/proc/27686/task/27689/ns/net 4026532565
/proc/self/ns/net 4026531969
/proc/27686/task/27689/ns/net 4026532565

See also:
https://github.com/vishvananda/netns/commit/008d17ae001344769b031375bdb38a86219154c6

Running Suite: pkg/ns Suite
===========================
Random Seed: 1459953577
Will run 6 of 6 specs

• Failure [0.028 seconds]
Linux namespace operations
/cni/gopath/src/github.com/appc/cni/pkg/ns/ns_test.go:167
  WithNetNS
  /cni/gopath/src/github.com/appc/cni/pkg/ns/ns_test.go:166
    executes the callback within the target network namespace [It]
    /cni/gopath/src/github.com/appc/cni/pkg/ns/ns_test.go:97

    Expected
        <uint64>: 4026531969
    to equal
        <uint64>: 4026532565

    /cni/gopath/src/github.com/appc/cni/pkg/ns/ns_test.go:96
------------------------------
•••••

Summarizing 1 Failure:

[Fail] Linux namespace operations WithNetNS [It] executes the callback within the target network namespace
/cni/gopath/src/github.com/appc/cni/pkg/ns/ns_test.go:96

Ran 6 of 6 Specs in 0.564 seconds
FAIL! -- 5 Passed | 1 Failed | 0 Pending | 0 Skipped --- FAIL: TestNs (0.56s)
FAIL

9 years agoFix issues with MakeNetworkNS test helper
Gabe Rosenhouse [Mon, 18 Apr 2016 02:44:00 +0000 (19:44 -0700)]
Fix issues with MakeNetworkNS test helper

9 years agoAdd basic unit tests of testhelpers
Gabe Rosenhouse [Mon, 18 Apr 2016 01:48:50 +0000 (18:48 -0700)]
Add basic unit tests of testhelpers

9 years agoExtract inode inspection functions into testhelpers
Gabe Rosenhouse [Mon, 18 Apr 2016 01:35:49 +0000 (18:35 -0700)]
Extract inode inspection functions into testhelpers

9 years agoExtract testhelpers from loopback test suite
Gabe Rosenhouse [Mon, 18 Apr 2016 01:28:10 +0000 (18:28 -0700)]
Extract testhelpers from loopback test suite

9 years ago*: appc/cni -> containernetworking/cni
Stefan Junker [Wed, 4 May 2016 14:06:05 +0000 (16:06 +0200)]
*: appc/cni -> containernetworking/cni

The project has been moved so internally we simply rename everything.
Consumers are recommended to update their vendored version of cni.

9 years agoMerge pull request #187 from appc/v0.3.0
Stefan Junker [Fri, 22 Apr 2016 17:25:54 +0000 (19:25 +0200)]
Merge pull request #187 from appc/v0.3.0

merge unneeded branch v0.3.0 into master

9 years agoMerge pull request #182 from rosenhouse/document-lockosthread
Zach Gershman [Mon, 18 Apr 2016 17:45:46 +0000 (10:45 -0700)]
Merge pull request #182 from rosenhouse/document-lockosthread

Document use of goroutine and LockOSThread in test helpers

9 years agons: fix reading net namespace in multi-threaded processes
Dan Williams [Wed, 6 Apr 2016 16:03:31 +0000 (11:03 -0500)]
ns: fix reading net namespace in multi-threaded processes

/proc/self/ns/net gives the main thread's namespace, not necessarily
the namespace of the thread that's running the testcases.  This causes
sporadic failures of the tests.

For example, with a testcase reading inodes after switching netns:

/proc/27686/task/27689/ns/net 4026532565
/proc/self/ns/net 4026531969
/proc/27686/task/27689/ns/net 4026532565

See also:
https://github.com/vishvananda/netns/commit/008d17ae001344769b031375bdb38a86219154c6

Running Suite: pkg/ns Suite
===========================
Random Seed: 1459953577
Will run 6 of 6 specs

• Failure [0.028 seconds]
Linux namespace operations
/cni/gopath/src/github.com/appc/cni/pkg/ns/ns_test.go:167
  WithNetNS
  /cni/gopath/src/github.com/appc/cni/pkg/ns/ns_test.go:166
    executes the callback within the target network namespace [It]
    /cni/gopath/src/github.com/appc/cni/pkg/ns/ns_test.go:97

    Expected
        <uint64>: 4026531969
    to equal
        <uint64>: 4026532565

    /cni/gopath/src/github.com/appc/cni/pkg/ns/ns_test.go:96
------------------------------
•••••

Summarizing 1 Failure:

[Fail] Linux namespace operations WithNetNS [It] executes the callback within the target network namespace
/cni/gopath/src/github.com/appc/cni/pkg/ns/ns_test.go:96

Ran 6 of 6 Specs in 0.564 seconds
FAIL! -- 5 Passed | 1 Failed | 0 Pending | 0 Skipped --- FAIL: TestNs (0.56s)
FAIL

9 years agoDocument use of goroutine and lockosthread in test helpers
Gabe Rosenhouse [Mon, 18 Apr 2016 03:27:02 +0000 (20:27 -0700)]
Document use of goroutine and lockosthread in test helpers

9 years agoFix issues with MakeNetworkNS test helper
Gabe Rosenhouse [Mon, 18 Apr 2016 02:44:00 +0000 (19:44 -0700)]
Fix issues with MakeNetworkNS test helper

9 years agoAdd basic unit tests of testhelpers
Gabe Rosenhouse [Mon, 18 Apr 2016 01:48:50 +0000 (18:48 -0700)]
Add basic unit tests of testhelpers

9 years agoExtract inode inspection functions into testhelpers
Gabe Rosenhouse [Mon, 18 Apr 2016 01:35:49 +0000 (18:35 -0700)]
Extract inode inspection functions into testhelpers