Thetype exposes the following members.
Constructs the fixture.
Used for derived classes that need to disable the Reset call on construction
Returns the subfixtures.(Inherited from ComposedFixture.)
Some Docker clear operations appear to take a few moments to complete. This delay will be added afterwards in an attempt to address this.
Returns the number of fixtures in the set.(Inherited from ComposedFixture.)
Returns true if the Start(Action) method is running.(Inherited from TestFixture.)
Returns true if the instance has been disposed.(Inherited from TestFixture.)
Returns true if the fixture has been initialized.(Inherited from TestFixture.)
Returns the fixture at the specified index (based on the order the fixture was added.(Inherited from ComposedFixture.)
Returns the named test fixture.(Inherited from ComposedFixture.)
Returns an integrated HostsFixture that can be used to manage DNS entries in the local machine's DNS hosts file.
Used by unit test classes to persist arbitrary name/value information across individual unit tests.(Inherited from TestFixture.)
Adds a named ITestFixture.(Inherited from ComposedFixture.)
Adds a named NeonServiceFixtureTService fixture.(Inherited from ComposedFixture.)
Verifies that the fixture instance has not been disposed.(Inherited from TestFixture.)
Verifies that the fixture instance's Start(Action) method is executing.(Inherited from TestFixture.)
Removes all swarm configs.
Removes all running containers.
Removes all unreferenced images from the target test node. Reset does not do this for performance reasonse but tests may use this method if necessary.
Removes all swarm networks.
Removes all swarm secrets.
Removes all deployed services.
Removes all deployed stacks.
Removes all swarm volumes.
|CreateConfig(String, Byte, String)|
Creates a Docker config from bytes.
|CreateConfig(String, String, String)|
Creates a Docker config from text.
Creates a Docker network.
|CreateSecret(String, Byte, String)|
Creates a Docker secret from bytes.
|CreateSecret(String, String, String)|
Creates a Docker secret from text.
Creates a Docker service.
Deploys a Docker stack.
Performs application-defined tasks associated with freeing, releasing, or resetting unmanaged resources.(Inherited from TestFixture.)
Releases all associated resources.(Overrides ComposedFixtureDispose(Boolean).)
Executes an arbitrary docker CLI command passing unformatted arguments and returns the results.
Executes an arbitrary docker CLI command passing a pre-formatted argument string and returns the results.
Called by TestFixture to ensure that Docker is reset after an interrupted test run.
Determines whether the specified object is equal to the current object.(Inherited from Object.)
Enumerates the named test fixtures in the set.(Inherited from ComposedFixture.)
Serves as the default hash function.(Inherited from Object.)
Gets the Type of the current instance.(Inherited from Object.)
Inspects a service, returning details about its current state.
Returns information about the current swarm configs.
Returns information about the current Docker containers.
Returns information about the current swarm networks.
Returns information about the current swarm secrets.
Returns information about the current swarm services.
Returns information about the current swarm stacks.
Creates a shallow copy of the current Object.(Inherited from Object.)
(Inherited from TestFixture.)
Called when an already started fixture is being restarted. This provides the fixture an opportunity to do some custom initialization. This base method does nothing.
Pulls a specific image to the target test node.
Removes a Docker config.
Removes a Docker container.
Removes a Docker network.
Removes a Docker secret.
Removes a Docker service.
Removes a Docker stack.
Resets the local Docker daemon by clearing all swarm services and state as well as removing all containers.(Overrides ComposedFixtureReset.)
Restarts a Docker service.
Rolls back a Docker service.
Creates a Docker container.
Starts the fixture if it hasn't already been started including invoking the optional Action when the first time Start(Action) is called for a fixture instance.(Inherited from ComposedFixture.)
Returns a string that represents the current object.(Inherited from Object.)
Updates a Docker service.
Identifies the built-in Docker networks. These networks will not be returned by ListNetworks(Boolean) and cannot be deleted.
IMPORTANT: The base Neon TestFixture implementation DOES NOT support parallel test execution because fixtures may impact global machine state like starting a Docker container, modifying the local DNS hosts file, configuring environment variables or initializing a test database.
You should explicitly disable parallel execution in all test assemblies that rely on test fixtures by adding a C# file called AssemblyInfo.cs with:
[assembly: CollectionBehavior(DisableTestParallelization = true, MaxParallelThreads = 1)]
This fixture resets the state of the local Docker daemon before and after the test runner executes the tests in a test class by removing all containers and services as well as swarm items such as secrets, configs and networks.
|This fixture works only for local Docker instances that ARE NOT members of a multi-node cluster as a safety measure to help avoid the possiblity of accidentially wiping out a production cluster.|
|The fixture Reset method does not purge images from the target test node for performance reasons. This can be a problem if you're testing container and you need to ensure that the latest image is downloaded from the registry first. You can call ClearImages to accomplish this or PullImage(String) to pull a specific image from the registry.|
This fixture is pretty easy to use. Simply have your test class inherit from Start(Action) method within the constructor and optionally have your custom Action use the fixture to initialize swarm services, networks, secrets, etc.and add a public constructor that accepts a as the only argument. Then you can call it's
This fixture provides several methods for managing the cluster state. These may be called within the test class constructor's action method, within the test constructor but outside of tha action, or within the test methods:
|Local Machine DNS||LocalMachineHosts|
CreateConfig(String, Byte, String)
CreateConfig(String, String, String)
RemoveContainer(String)RunContainer(String, String, String, String, String)
CreateSecret(String, Byte, String)
CreateSecret(String, String, String)
CreateService(String, String, String, String, String)
DeployStack(String, String, String, TimeSpan, TimeSpan)
|ComposedFixture so you can use AddFixtureTFixture(String, TFixture, ActionTFixture) to add additional fixtures within your custom initialization action for advanced scenarios.derives from|
There are two basic patterns for using this fixture.
The basic idea here is to have your test class initialize the swarm once within the test class constructor inside of the initialize action with common state and services that all of the tests can access.
This will be quite a bit faster than reconfiguring the swarm at the beginning of every test and can work well for many situations but it assumes that your test methods guarantee that running any test in any order will not impact the results of subsequent tests. A good example of this is a series of read-only tests against a service or database.
|initialize every test||For common scenarios where the swarm must be reset before every test, you can call Reset within the test class constructor (but outside of the custom initialization Action to reset the swarm state before the next test method is invoked.|