1- using NUnit . Framework ;
1+ using System ;
2+ using FluentAssertions ;
3+ using NUnit . Framework ;
24
35namespace Nest . Tests . Unit . Cluster
46{
@@ -9,25 +11,33 @@ public class HealthTests : BaseJsonTests
911 public void ClusterHealth ( )
1012 {
1113 var r = this . _client . Health ( HealthLevel . Cluster ) ;
12- Assert . True ( r . IsValid ) ;
14+ var u = new Uri ( r . ConnectionStatus . RequestUrl ) ;
15+ u . AbsolutePath . Should ( ) . StartWith ( "/_cluster/health" ) ;
16+ u . Query . Should ( ) . Contain ( "level=cluster" ) ;
1317 }
1418 [ Test ]
1519 public void ClusterHealthPerIndex ( )
1620 {
1721 var r = this . _client . Health ( new [ ] { Test . Default . DefaultIndex } , HealthLevel . Cluster ) ;
18- Assert . True ( r . IsValid ) ;
22+ var u = new Uri ( r . ConnectionStatus . RequestUrl ) ;
23+ u . AbsolutePath . Should ( ) . StartWith ( "/_cluster/health/nest_test_data" ) ;
24+ u . Query . Should ( ) . Contain ( "level=cluster" ) ;
1925 }
2026 [ Test ]
2127 public void IndexHealth ( )
2228 {
2329 var r = this . _client . Health ( HealthLevel . Indices ) ;
24- Assert . True ( r . IsValid ) ;
30+ var u = new Uri ( r . ConnectionStatus . RequestUrl ) ;
31+ u . AbsolutePath . Should ( ) . StartWith ( "/_cluster/health" ) ;
32+ u . Query . Should ( ) . Contain ( "level=indices" ) ;
2533 }
2634 [ Test ]
2735 public void ShardHealth ( )
2836 {
2937 var r = this . _client . Health ( HealthLevel . Shards ) ;
30- Assert . True ( r . IsValid ) ;
38+ var u = new Uri ( r . ConnectionStatus . RequestUrl ) ;
39+ u . AbsolutePath . Should ( ) . StartWith ( "/_cluster/health" ) ;
40+ u . Query . Should ( ) . Contain ( "level=shards" ) ;
3141 }
3242 [ Test ]
3343 public void DetailedHealth ( )
@@ -37,22 +47,16 @@ public void DetailedHealth()
3747 CheckLevel = HealthLevel . Shards ,
3848 Timeout = "30s" ,
3949 WaitForMinNodes = 1 ,
40- WaitForRelocatingShards = 0
50+ WaitForRelocatingShards = 0 ,
51+ WaitForStatus = HealthStatus . Green
4152 } ) ;
42- Assert . True ( r . IsValid ) ;
43- }
44- [ Test ]
45- public void DetailedHealthPerIndex ( )
46- {
47- var r = this . _client . Health ( new [ ] { Test . Default . DefaultIndex } ,
48- new HealthParams
49- {
50- CheckLevel = HealthLevel . Shards ,
51- Timeout = "30s" ,
52- WaitForMinNodes = 1 ,
53- WaitForRelocatingShards = 0
54- } ) ;
55- Assert . True ( r . IsValid ) ;
53+ var u = new Uri ( r . ConnectionStatus . RequestUrl ) ;
54+ u . AbsolutePath . Should ( ) . StartWith ( "/_cluster/health" ) ;
55+ u . Query . Should ( ) . Contain ( "level=shards" ) ;
56+ u . Query . Should ( ) . Contain ( "timeout=30s" ) ;
57+ u . Query . Should ( ) . Contain ( "wait_for_nodes=1" ) ;
58+ u . Query . Should ( ) . Contain ( "wait_for_relocating_shards=0" ) ;
59+ u . Query . Should ( ) . Contain ( "wait_for_status=green" ) ;
5660 }
5761 }
5862}
0 commit comments