Skip to content

Commit

Permalink
fixing broken test after exception catching when calling AWS
Browse files Browse the repository at this point in the history
Signed-off-by: Ash.Wani <[email protected]>
  • Loading branch information
wani-guanxi committed Jan 27, 2025
1 parent 79e4f0b commit a14bc85
Showing 1 changed file with 13 additions and 11 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -167,7 +167,7 @@ await Assert.ThrowsAsync<ArgumentException>(() =>
}

[Fact]
public async Task GetConfiguration_WhenServiceThrows_PropagatesException()
public async Task GetConfiguration_WhenServiceThrows_DoNotPropagatesException()
{
// Arrange
var profile = new FeatureFlagProfile{
Expand All @@ -181,16 +181,18 @@ public async Task GetConfiguration_WhenServiceThrows_PropagatesException()
It.IsAny<StartConfigurationSessionRequest>(),
It.IsAny<CancellationToken>()))
.ReturnsAsync(new StartConfigurationSessionResponse{InitialConfigurationToken="initialToken"});

_appConfigClientMock
.Setup(x => x.GetLatestConfigurationAsync(
It.IsAny<GetLatestConfigurationRequest>(),
It.IsAny<CancellationToken>()))
.ThrowsAsync(new AmazonAppConfigDataException("Test exception"));

// Act & Assert
await Assert.ThrowsAsync<AmazonAppConfigDataException>(() =>
_retrievalApi.GetLatestConfigurationAsync(profile));
try
{
_appConfigClientMock
.Setup(x => x.GetLatestConfigurationAsync(
It.IsAny<GetLatestConfigurationRequest>(),
It.IsAny<CancellationToken>()))
.ThrowsAsync(new AmazonAppConfigDataException("Test exception"));
}
catch (Exception e)
{
Assert.Null(e); // No exception expected
}
}

[Fact]
Expand Down

0 comments on commit a14bc85

Please sign in to comment.