Click here to Skip to main content
15,889,096 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Currently I have a common database used for component tests in xunit, the problem is that when a build is running on teamcity other builds cannot start as while one build is being run a number of tests are being executed which take quite some time. I need some help of how can I have my current class modified/changed in order to have multiple builds executing in parallel using multiple database instances

public class DatabaseFixture : IDisposable
	{
		public TestCluster Cluster { get; }
		public IGrainFactory GrainFactory => Cluster?.GrainFactory;
		public IClusterClient Client => Cluster?.Client;

		private const string _databaseConnection = @"Server=(localdb)\MSSQLLocalDB;Integrated Security=true";

			public DatabaseFixture()
		{
			// Find a valid folder for now
			foreach (var folder in _dbFolders)
			{
				if (!Directory.Exists(folder))
					continue;
				_databaseRootFolder = folder;
				break;
			}
			Assert.NotNull(_databaseRootFolder);

			// Create the test database
			CreateDatabase();
			CreateConfigDatabase();

			// Setup and start the cluster
			var builder = new TestClusterBuilder(2);
			builder.AddSiloBuilderConfigurator<DbTestSiloBuilderConfigurator>();

			var testCluster = builder.Build();
			if (testCluster?.Primary == null)
			{
				testCluster?.Deploy();
			}
			Cluster = testCluster;
		}
		
		// other methods that follow have been removed for keeping question short
	}


What I have tried:

Upto now only some research if this is possible
Posted
Updated 7-Feb-21 22:40pm
v2

1 solution

The simplest solution would be to install another TeamCity Agent on another machine so you can build on multiple machines.
Although not really recommended it should also be possible to install multiple Agents on the same machine.

This might not be what you want, but you can run multiple tests in parallel:
nunit - TeamCity: How to run tests projects in parallel - Stack Overflow[^]
.net - TeamCity run Nunit tests in Parallel - Stack Overflow[^]

The newest TeamCity version 2020.2 features "Agentless build steps", see:
What's New in TeamCity 2020.2—TeamCity[^]
 
Share this answer
 
v5

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900