Unverified Commit 2090d7da authored by Nick Craver's avatar Nick Craver Committed by GitHub

Actions! Let's see if we can make this merry-go-round spin. (#1398)

Billing issues have cleared on the org - taking a stab at this.

First attempt: let's get a Linux CI going.
parent cbe5ceed
<Project Sdk="Microsoft.Build.NoTargets/1.0.94">
<PropertyGroup>
<TargetFramework>netcoreapp3.1</TargetFramework>
</PropertyGroup>
</Project>
\ No newline at end of file
name: Linux CI
on:
pull_request:
push:
branches:
- master
paths:
- '*'
- '!/docs/*' # Don't run workflow when files are only in the /docs directory
jobs:
build:
name: Ubuntu
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v1
- name: .NET Build
run: dotnet build Build.csproj -c Release /p:CI=true
- name: Start Redis Services
working-directory: ./tests/RedisConfigs
run: docker-compose -f docker-compose.yml up -d
- name: .NET Test
run: dotnet test Build.csproj -c Release --no-build /p:CI=true
env:
EnableTestLogging: true
- name: .NET Lib Pack
run: dotnet pack Build.csproj --no-build -c Release /p:Packing=true /p:PackageOutputPath=%CD%\.nupkgs /p:CI=true
......@@ -123,6 +123,8 @@ Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "docs", "docs", "{153A10E4-E
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "TestConsoleBaseline", "toys\TestConsoleBaseline\TestConsoleBaseline.csproj", "{D58114AE-4998-4647-AFCA-9353D20495AE}"
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = ".github", ".github\.github.csproj", "{8FB98E7D-DAE2-4465-BD9A-104000E0A2D4}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Any CPU = Debug|Any CPU
......@@ -169,6 +171,10 @@ Global
{D58114AE-4998-4647-AFCA-9353D20495AE}.Debug|Any CPU.Build.0 = Debug|Any CPU
{D58114AE-4998-4647-AFCA-9353D20495AE}.Release|Any CPU.ActiveCfg = Release|Any CPU
{D58114AE-4998-4647-AFCA-9353D20495AE}.Release|Any CPU.Build.0 = Release|Any CPU
{8FB98E7D-DAE2-4465-BD9A-104000E0A2D4}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{8FB98E7D-DAE2-4465-BD9A-104000E0A2D4}.Debug|Any CPU.Build.0 = Debug|Any CPU
{8FB98E7D-DAE2-4465-BD9A-104000E0A2D4}.Release|Any CPU.ActiveCfg = Release|Any CPU
{8FB98E7D-DAE2-4465-BD9A-104000E0A2D4}.Release|Any CPU.Build.0 = Release|Any CPU
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
......
......@@ -8,6 +8,7 @@ COPY Sentinel /data/Sentinel/
RUN chown -R redis:redis /data
COPY Docker/docker-entrypoint.sh /usr/local/bin/
RUN chmod +x /usr/local/bin/docker-entrypoint.sh
RUN apt-get -y update && apt-get install -y git gcc make supervisor && apt-get clean
......
......@@ -237,14 +237,15 @@ public async Task SubscriptionsSurviveMasterSwitchAsync()
Assert.False(b.GetServer(TestConfig.Current.FailoverMasterServerAndPort).IsSlave, $"B Connection: {TestConfig.Current.FailoverMasterServerAndPort} should be a master");
Assert.True(b.GetServer(TestConfig.Current.FailoverSlaveServerAndPort).IsSlave, $"B Connection: {TestConfig.Current.FailoverSlaveServerAndPort} should be a slave");
Log("Failover 1 Complete");
var epA = subA.SubscribedEndpoint(channel);
var epB = subB.SubscribedEndpoint(channel);
Log("A: " + EndPointCollection.ToString(epA));
Log("B: " + EndPointCollection.ToString(epB));
Log(" A: " + EndPointCollection.ToString(epA));
Log(" B: " + EndPointCollection.ToString(epB));
subA.Publish(channel, "A1");
subB.Publish(channel, "B1");
Log("SubA ping: " + subA.Ping());
Log("SubB ping: " + subB.Ping());
Log(" SubA ping: " + subA.Ping());
Log(" SubB ping: " + subB.Ping());
// If redis is under load due to this suite, it may take a moment to send across.
await UntilCondition(5000, () => Interlocked.Read(ref aCount) == 2 && Interlocked.Read(ref bCount) == 2).ForAwait();
......@@ -266,16 +267,17 @@ public async Task SubscriptionsSurviveMasterSwitchAsync()
await UntilCondition(3000, () => b.GetServer(TestConfig.Current.FailoverMasterServerAndPort).IsSlave).ForAwait();
subA.Ping();
subB.Ping();
Log("Pausing...");
Log("A " + TestConfig.Current.FailoverMasterServerAndPort + " status: " + (a.GetServer(TestConfig.Current.FailoverMasterServerAndPort).IsSlave ? "Slave" : "Master"));
Log("A " + TestConfig.Current.FailoverSlaveServerAndPort + " status: " + (a.GetServer(TestConfig.Current.FailoverSlaveServerAndPort).IsSlave ? "Slave" : "Master"));
Log("B " + TestConfig.Current.FailoverMasterServerAndPort + " status: " + (b.GetServer(TestConfig.Current.FailoverMasterServerAndPort).IsSlave ? "Slave" : "Master"));
Log("B " + TestConfig.Current.FailoverSlaveServerAndPort + " status: " + (b.GetServer(TestConfig.Current.FailoverSlaveServerAndPort).IsSlave ? "Slave" : "Master"));
Log("Falover 2 Attempted. Pausing...");
Log(" A " + TestConfig.Current.FailoverMasterServerAndPort + " status: " + (a.GetServer(TestConfig.Current.FailoverMasterServerAndPort).IsSlave ? "Slave" : "Master"));
Log(" A " + TestConfig.Current.FailoverSlaveServerAndPort + " status: " + (a.GetServer(TestConfig.Current.FailoverSlaveServerAndPort).IsSlave ? "Slave" : "Master"));
Log(" B " + TestConfig.Current.FailoverMasterServerAndPort + " status: " + (b.GetServer(TestConfig.Current.FailoverMasterServerAndPort).IsSlave ? "Slave" : "Master"));
Log(" B " + TestConfig.Current.FailoverSlaveServerAndPort + " status: " + (b.GetServer(TestConfig.Current.FailoverSlaveServerAndPort).IsSlave ? "Slave" : "Master"));
if (!a.GetServer(TestConfig.Current.FailoverMasterServerAndPort).IsSlave)
{
TopologyFail();
}
Log("Falover 2 Complete.");
Assert.True(a.GetServer(TestConfig.Current.FailoverMasterServerAndPort).IsSlave, $"A Connection: {TestConfig.Current.FailoverMasterServerAndPort} should be a slave");
Assert.False(a.GetServer(TestConfig.Current.FailoverSlaveServerAndPort).IsSlave, $"A Connection: {TestConfig.Current.FailoverSlaveServerAndPort} should be a master");
......@@ -288,22 +290,28 @@ public async Task SubscriptionsSurviveMasterSwitchAsync()
Assert.False(b.GetServer(TestConfig.Current.FailoverSlaveServerAndPort).IsSlave, $"B Connection: {TestConfig.Current.FailoverSlaveServerAndPort} should be a master");
Log("Pause complete");
Log("A outstanding: " + a.GetCounters().TotalOutstanding);
Log("B outstanding: " + b.GetCounters().TotalOutstanding);
Log(" A outstanding: " + a.GetCounters().TotalOutstanding);
Log(" B outstanding: " + b.GetCounters().TotalOutstanding);
subA.Ping();
subB.Ping();
await Task.Delay(1000).ForAwait();
epA = subA.SubscribedEndpoint(channel);
epB = subB.SubscribedEndpoint(channel);
Log("A: " + EndPointCollection.ToString(epA));
Log("B: " + EndPointCollection.ToString(epB));
Log("A2 sent to: " + subA.Publish(channel, "A2"));
Log("B2 sent to: " + subB.Publish(channel, "B2"));
Log("Subscription complete");
Log(" A: " + EndPointCollection.ToString(epA));
Log(" B: " + EndPointCollection.ToString(epB));
Log(" A2 sent to: " + subA.Publish(channel, "A2"));
Log(" B2 sent to: " + subB.Publish(channel, "B2"));
subA.Ping();
subB.Ping();
Log("Checking...");
Log("Ping Complete. Checking...");
await UntilCondition(10000, () => Interlocked.Read(ref aCount) == 2 && Interlocked.Read(ref bCount) == 2).ForAwait();
Log("Counts so far:");
Log(" aCount: " + Interlocked.Read(ref aCount));
Log(" bCount: " + Interlocked.Read(ref bCount));
Log(" masterChanged: " + Interlocked.Read(ref masterChanged));
Assert.Equal(2, Interlocked.Read(ref aCount));
Assert.Equal(2, Interlocked.Read(ref bCount));
// Expect 6, because a sees a, but b sees a and b due to replication
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment