Skip to content

Commit

Permalink
Tweaks to SslEnv, naming
Browse files Browse the repository at this point in the history
  • Loading branch information
lukebakken committed Oct 10, 2023
1 parent c6d5e15 commit 0ba106d
Show file tree
Hide file tree
Showing 5 changed files with 19 additions and 16 deletions.
File renamed without changes.
4 changes: 2 additions & 2 deletions .github/workflows/main.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ jobs:
path: ~/installers
key: ${{ runner.os }}-v0-${{ hashFiles('.ci/versions.json') }}
- name: Cache NuGet packages
uses: actions/cache@v2
uses: actions/cache@v3
with:
path: |
~/.nuget/packages
Expand All @@ -38,7 +38,7 @@ jobs:
restore-keys: |
${{ runner.os }}-v1-nuget-
- name: Install and Start RabbitMQ
run: .\.ci\windows\install.ps1
run: .\.ci\windows\gha-setup.ps1
- name: List NuGet sources
run: dotnet nuget locals all --list
- name: Build
Expand Down
27 changes: 15 additions & 12 deletions projects/Unit/SslEnv.cs
Original file line number Diff line number Diff line change
Expand Up @@ -36,11 +36,12 @@ namespace RabbitMQ.Client.Unit
{
public class SslEnv
{
private readonly string _sslDir;
private readonly string _certPassphrase;
private readonly string _certPath;
private readonly string _hostname;
private readonly string _sslDir;
private readonly bool _isSslConfigured;
private readonly bool _isGithubActions;
private readonly string _hostname;

public SslEnv()
{
Expand All @@ -60,31 +61,33 @@ public SslEnv()
{
_hostname = System.Net.Dns.GetHostName();
}

_certPath = Path.Combine(_sslDir, $"client_{_hostname}.p12");
}

public bool IsSslConfigured
public string CertPath
{
get { return _isSslConfigured; }
get { return _certPath; }
}

public bool IsGitHubActions
public string CertPassphrase
{
get { return _isGithubActions; }
get { return _certPassphrase; }
}

public string SslDir
public string Hostname
{
get { return _sslDir; }
get { return _hostname; }
}

public string CertPassphrase
public bool IsSslConfigured
{
get { return _certPassphrase; }
get { return _isSslConfigured; }
}

public string Hostname
public bool IsGitHubActions
{
get { return _hostname; }
get { return _isGithubActions; }
}
}
}
2 changes: 1 addition & 1 deletion projects/Unit/TestHeartbeats.cs
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,7 @@ public void TestThatHeartbeatWriterWithTLSEnabled()
};

cf.Ssl.ServerName = sslEnv.Hostname;
cf.Ssl.CertPath = $"{sslEnv.SslDir}/client_{sslEnv.Hostname}.p12";
cf.Ssl.CertPath = sslEnv.CertPath;
cf.Ssl.CertPassphrase = sslEnv.CertPassphrase;
cf.Ssl.Enabled = true;

Expand Down
2 changes: 1 addition & 1 deletion projects/Unit/TestSsl.cs
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,7 @@ public void TestClientAndServerVerified()
{
Skip.IfNot(_sslEnv.IsSslConfigured, "SSL_CERTS_DIR and/or PASSWORD are not configured, skipping test");

string certPath = $"{_sslEnv.SslDir}/client_{_sslEnv.Hostname}.p12";
string certPath = _sslEnv.CertPath;
_output.WriteLine($"[INFO] certPath: {certPath}");
Assert.True(File.Exists(certPath));

Expand Down

0 comments on commit 0ba106d

Please sign in to comment.