Skip to content

Commit e9ba9e1

Browse files
author
William Denton
committed
Improve failing tests debugging output
1 parent 136b739 commit e9ba9e1

File tree

2 files changed

+13
-3
lines changed

2 files changed

+13
-3
lines changed

src/Elasticsearch.Net.Aws/ElasticSearch.Net.Aws.IntegrationTests/PostTests.cs

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,7 @@ public void Setup()
2222
var httpConnection = new AwsHttpConnection(Region);
2323
var pool = new SingleNodeConnectionPool(new Uri(TestConfig.Endpoint));
2424
var config = new ConnectionConfiguration(pool, httpConnection);
25+
config.DisableDirectStreaming();
2526
_client = new ElasticLowLevelClient(config);
2627
_indexName = $"unittest_{Guid.NewGuid().ToString("n")}";
2728
}
@@ -37,9 +38,9 @@ public void SimplePost_should_work()
3738
{
3839
var id = Guid.NewGuid().ToString("n");
3940
var response = _client.Create<VoidResponse>(_indexName, id, PostData.Serializable(new { message = "Hello, World!" }));
40-
Assert.AreEqual(true, response.Success);
41+
Assert.AreEqual(true, response.Success, response.DebugInformation);
4142
var getResponse = _client.Get<StringResponse>(_indexName, id);
42-
Assert.AreEqual(true, getResponse.Success);
43+
Assert.AreEqual(true, getResponse.Success, getResponse.DebugInformation);
4344
StringAssert.Contains("Hello, World!", getResponse.Body);
4445
}
4546
}

src/Elasticsearch.Net.Aws/Elasticsearch.Net.Aws/AwsHttpConnection.cs

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -65,7 +65,16 @@ private void SignRequest(IRequest request, RequestData requestData)
6565
}
6666
}
6767
}
68-
var credentials = _credentials.GetCredentials();
68+
ImmutableCredentials credentials;
69+
try
70+
{
71+
credentials = _credentials.GetCredentials();
72+
}
73+
catch (Exception e)
74+
{
75+
throw new Exception("Unable to retrieve credentials required to sign the request.", e);
76+
}
77+
6978
if (credentials == null)
7079
{
7180
throw new Exception("Unable to retrieve credentials required to sign the request.");

0 commit comments

Comments
 (0)