Class YugaByteFixture
Used to run YugaByte database server and its related and services as a Docker compose application on the current machine as a test fixture while tests are being performed and then deletes the application when the fixture is disposed.
Implements
Inherited Members
Namespace: Neon.Xunit.YugaByte
Assembly: Neon.Xunit.YugaByte.dll
Syntax
public sealed class YugaByteFixture : DockerComposeFixture, ITestFixture
Remarks
This fixture assumes that YugaByte is not currently running on the local workstation or is running as a application named yugabyte-dev. You may see port conflict errors if either of these conditions are not true.
See Start(string, string, string, bool, int, int) for more information about how this works.
Constructors
YugaByteFixture()
Constructs the fixture.
Declaration
public YugaByteFixture()
Properties
CassandraSession
Returns the Cassandra session.
Declaration
public ISession CassandraSession { get; }
Property Value
Type | Description |
---|---|
ISession |
PostgresConnection
Returns the Postgres connection.
Declaration
public NpgsqlConnection PostgresConnection { get; }
Property Value
Type | Description |
---|---|
NpgsqlConnection |
Methods
Restart()
Restarts the application. This is a handy way to deploy a fresh instance with the same properties while running unit tests.
Declaration
public override void Restart()
Overrides
Start(string, string, string, bool, int, int)
Starts a YugaByte compose application if it's not already running. You'll generally want to call this in your test class constructor instead of Start(Action).
note
You'll need to call StartAsComposed(string, string, string, bool, int, int) instead when this fixture is being added to a ComposedFixture.
Declaration
public TestFixtureStatus Start(string name = "yugabyte-dev", string cassandraKeyspace = "test_cassandra", string postgresDatabase = "test_postgres", bool keepRunning = false, int ycqlPort = 9042, int ysqlPort = 5432)
Parameters
Type | Name | Description |
---|---|---|
string | name | Optionally specifies the Docker compose application name (defaults to yugabyte-dev). |
string | cassandraKeyspace | Optionally specifies the Cassandra keyspace. This defaults to test_cassandra. Note that
the |
string | postgresDatabase | Optionally specifies the Postgres database. This defaults to test_postgres. Note that
the |
bool | keepRunning | Optionally indicates that the compose application should remain running after the fixture is disposed. |
int | ycqlPort | Specifies the port to be exposed by the Cassandra YCQL service. This currently defaults to DefaultYcqlPort which is temporarily set to 9099 to avoid conflicts with the Cassandra DBs deployed by the Cadence test fixtures but we hope eventually to change those to use a different port so we can revert this to the standard 9042 port. |
int | ysqlPort | Specifies the port to be exposed by the Postgres YCQL service. This defaults to DefaultYsqlPort which is set to the default Postgres port 5433. |
Returns
Type | Description |
---|---|
TestFixtureStatus | Started if the fixture wasn't previously started and this method call started it or AlreadyRunning if the fixture was already running. |
StartAsComposed(string, string, string, bool, int, int)
Used to start the fixture within a ComposedFixture.
Declaration
public void StartAsComposed(string name = "yugabyte-dev", string cassandraKeyspace = "test_cassandra", string postgresDatabase = "test_postgres", bool keepRunning = false, int ycqlPort = 9042, int ysqlPort = 5432)
Parameters
Type | Name | Description |
---|---|---|
string | name | Optionally specifies the YugaByte compose application name (defaults to yugabyte-dev). |
string | cassandraKeyspace | Optionally specifies the name of the test Cassandra keyspace to be created. This defaults to test_cassandra.
Note that the |
string | postgresDatabase | Optionally specifies the name of the test Postgres database to be created. This defaults to test_postgres.
Note that the |
bool | keepRunning | Optionally indicates that the compose application should remain running after the fixture is disposed. |
int | ycqlPort | Specifies the port to be exposed by the Cassandra YCQL service. This currently defaults to DefaultYcqlPort which is temporarily set to 9099 to avoid conflicts with the Cassandra DBs deployed by the Cadence tess fixtures but we hope eventually to change those to use a different port so we can revert this to the standard 9042 port. |
int | ysqlPort | Specifies the port to be exposed by the Postgres YCQL service. This defaults to DefaultYsqlPort which is set to the default Postgres port 5433. |