Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Change Bytes read #25

Merged
merged 11 commits into from
Mar 15, 2019
Merged

Change Bytes read #25

merged 11 commits into from
Mar 15, 2019

Conversation

izavala
Copy link
Contributor

@izavala izavala commented Mar 15, 2019

Working on getting second failing test to pass. Should have this done soon, will set the tcp port to try and connect after the connection has closed and check to make sure an error is signaled as the port should refuse a connection.

@izavala
Copy link
Contributor Author

izavala commented Mar 15, 2019

Test are passing in Visual Studio but seem to be failing both the Linux and Windows, need to look into why both test are failing here

@izavala
Copy link
Contributor Author

izavala commented Mar 15, 2019

Looked through the logs and it looks like the test below is now failing, need to look into why it's failing:

[Fact(DisplayName = "End2End: should load complete custom Akka.HealthCheck config")]
public async Task Should_load_custom_HealthCheck_system_correctly()
{
// forces the plugin to load
var healthCheck = AkkaHealthCheck.For(Sys);
var readinessSubscriber = CreateTestProbe();
var livenessSubscriber = CreateTestProbe();
healthCheck.LivenessProbe.Tell(new SubscribeToLiveness(livenessSubscriber));
healthCheck.ReadinessProbe.Tell(new SubscribeToReadiness(readinessSubscriber));
livenessSubscriber.ExpectMsg<LivenessStatus>().IsLive.Should().BeTrue();
readinessSubscriber.ExpectMsg<ReadinessStatus>().IsReady.Should().BeTrue();
var filePath = healthCheck.Settings.ReadinessTransportSettings.As<FileTransportSettings>().FilePath;
var tcpPort = healthCheck.Settings.LivenessTransportSettings.As<SocketTransportSettings>().Port;
// check to see that our probes are up and running using the supplied transports
AwaitCondition(() => File.Exists(filePath));
var tcpClient = new TcpClient(AddressFamily.InterNetworkV6);
await tcpClient.ConnectAsync(IPAddress.IPv6Loopback, tcpPort);
// force shutdown of the ActorSystem and verify that probes are stopped
await Sys.Terminate();
// Readiness probe should not exist
AwaitCondition(() => !File.Exists(filePath));
// liveness probe should be disconnected
try
{
var bytesRead = await tcpClient.GetStream().ReadAsync(new byte[10], 0, 10);
bytesRead.Should().Be(0);
}
catch
{
}
tcpClient.Connected.Should().BeFalse();
}
}

@izavala
Copy link
Contributor Author

izavala commented Mar 15, 2019

When we are testing to see if we are still connected to the TCP port, we are not attempting to interact with the socket so it seems it may not be updating the status.

await Sys.Terminate();
// Readiness probe should not exist
AwaitCondition(() => !File.Exists(filePath));
// liveness probe should be disconnected
try
{
var bytesRead = await tcpClient.GetStream().ReadAsync(new byte[10], 0, 10);
bytesRead.Should().Be(0);
}
catch
{
}
tcpClient.Connected.Should().BeFalse();

@Aaronontheweb
Copy link
Member

/AzurePipelines run

@azure-pipelines
Copy link

Azure Pipelines successfully started running 2 pipeline(s).

@izavala
Copy link
Contributor Author

izavala commented Mar 15, 2019

/AzurePipelines run

1 similar comment
@Aaronontheweb
Copy link
Member

/AzurePipelines run

@azure-pipelines
Copy link

Azure Pipelines successfully started running 2 pipeline(s).

Copy link
Member

@Aaronontheweb Aaronontheweb left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good to me!


public static Config GetConfig()
{
var PortNumber = ThreadLocalRandom.Current.Next(10000, 64000);
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM


tcpClient.Connected.Should().BeFalse();
//Second client should not be able to connect as socket has been closed
AwaitCondition(()=> !tcpClient2.Connected);
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants