1
- using Microsoft . Azure . WebJobs . Script . WebHost . Models ;
2
- using Microsoft . Azure . WebJobs . Script . Workers . Rpc ;
3
- using Microsoft . WebJobs . Script . Tests ;
4
1
using System ;
5
2
using System . IO ;
6
3
using System . Net ;
7
4
using System . Threading . Tasks ;
5
+ using Microsoft . Azure . WebJobs . Script . WebHost . Models ;
6
+ using Microsoft . Azure . WebJobs . Script . Workers . Rpc ;
7
+ using Microsoft . WebJobs . Script . Tests ;
8
8
using Xunit ;
9
9
10
10
namespace Microsoft . Azure . WebJobs . Script . Tests . EndToEnd
@@ -17,7 +17,7 @@ public class FunctionsControllerEndToEndTests : FunctionsControllerTestFixture
17
17
public async Task FunctionsController_GetAllFunctions_ReturnsOk ( )
18
18
{
19
19
// Capture original instance ID
20
- var originalInstanceId = this . HostInstanceId ;
20
+ var originalInstanceId = await GetActiveHostInstanceIdAsync ( ) ;
21
21
22
22
// Validate ability to call HttpTrigger without issues
23
23
var response = await SamplesTestHelpers . InvokeHttpTrigger ( this , "HttpTrigger" ) ;
@@ -32,14 +32,14 @@ public async Task FunctionsController_GetAllFunctions_ReturnsOk()
32
32
Assert . Equal ( HttpStatusCode . OK , response . StatusCode ) ;
33
33
34
34
// Validate the instance ID is still the same
35
- Assert . Equal ( originalInstanceId , this . HostInstanceId ) ;
35
+ Assert . Equal ( originalInstanceId , await GetActiveHostInstanceIdAsync ( ) ) ;
36
36
}
37
37
38
38
[ Fact ]
39
39
public async Task FunctionsController_GetSpecificFunction_ReturnsOk ( )
40
40
{
41
41
// Capture original instance ID
42
- var originalInstanceId = this . HostInstanceId ;
42
+ var originalInstanceId = await GetActiveHostInstanceIdAsync ( ) ;
43
43
44
44
// Validate ability to call HttpTrigger without issues
45
45
var response = await SamplesTestHelpers . InvokeHttpTrigger ( this , "HttpTrigger" ) ;
@@ -55,14 +55,14 @@ public async Task FunctionsController_GetSpecificFunction_ReturnsOk()
55
55
Assert . Equal ( HttpStatusCode . OK , response . StatusCode ) ;
56
56
57
57
// Validate the instance ID is still the same
58
- Assert . Equal ( originalInstanceId , this . HostInstanceId ) ;
58
+ Assert . Equal ( originalInstanceId , await GetActiveHostInstanceIdAsync ( ) ) ;
59
59
}
60
60
61
61
[ Fact ]
62
62
public async Task FunctionsController_GetSpecificFunctionStatus_ReturnsOk ( )
63
63
{
64
64
// Capture original instance ID
65
- var originalInstanceId = this . HostInstanceId ;
65
+ var originalInstanceId = await GetActiveHostInstanceIdAsync ( ) ;
66
66
67
67
// Validate ability to call HttpTrigger without issues
68
68
var response = await SamplesTestHelpers . InvokeHttpTrigger ( this , "HttpTrigger" ) ;
@@ -77,14 +77,14 @@ public async Task FunctionsController_GetSpecificFunctionStatus_ReturnsOk()
77
77
Assert . Equal ( HttpStatusCode . OK , response . StatusCode ) ;
78
78
79
79
// Validate the instance ID is still the same
80
- Assert . Equal ( originalInstanceId , this . HostInstanceId ) ;
80
+ Assert . Equal ( originalInstanceId , await GetActiveHostInstanceIdAsync ( ) ) ;
81
81
}
82
82
83
83
[ Fact ]
84
84
public async Task FunctionsController_CreateUpdate_NoFileChange_ReturnsCreated_NoRestart ( )
85
85
{
86
86
// Capture original instance ID
87
- var originalInstanceId = this . HostInstanceId ;
87
+ var originalInstanceId = await GetActiveHostInstanceIdAsync ( ) ;
88
88
89
89
// Validate ability to call HttpTrigger without issues
90
90
var response = await SamplesTestHelpers . InvokeHttpTrigger ( this , "HttpTrigger" ) ;
@@ -99,14 +99,14 @@ public async Task FunctionsController_CreateUpdate_NoFileChange_ReturnsCreated_N
99
99
Assert . Equal ( HttpStatusCode . OK , response . StatusCode ) ;
100
100
101
101
// Validate the instance ID is still the same
102
- Assert . Equal ( originalInstanceId , this . HostInstanceId ) ;
102
+ Assert . Equal ( originalInstanceId , await GetActiveHostInstanceIdAsync ( ) ) ;
103
103
}
104
104
105
105
[ Fact ]
106
106
public async Task FunctionsController_CreateUpdate_FileChange_ReturnsCreated_RestartsJobHost ( )
107
107
{
108
108
// Capture pre-restart instance ID
109
- var originalInstanceId = this . HostInstanceId ;
109
+ var originalInstanceId = await GetActiveHostInstanceIdAsync ( ) ;
110
110
111
111
// Validate ability to call HttpTrigger without issues
112
112
var response = await SamplesTestHelpers . InvokeHttpTrigger ( this , "HttpTrigger" ) ;
@@ -125,7 +125,7 @@ public async Task FunctionsController_CreateUpdate_FileChange_ReturnsCreated_Res
125
125
Assert . Equal ( HttpStatusCode . OK , response . StatusCode ) ;
126
126
127
127
// Validate the instance ID has changed
128
- Assert . NotEqual ( originalInstanceId , this . HostInstanceId ) ;
128
+ Assert . NotEqual ( originalInstanceId , await GetActiveHostInstanceIdAsync ( ) ) ;
129
129
130
130
// Reset config
131
131
response = await SamplesTestHelpers . InvokeEndpointPut ( this , "admin/functions/HttpTrigger" , TestData ( ) ) ;
0 commit comments