@@ -16,7 +16,6 @@ public async Task StorageGetsCreatedAndUsable()
16
16
{
17
17
using var distributedApplicationBuilder = TestDistributedApplicationBuilder . Create ( testOutputHelper ) ;
18
18
var rootUser = "minioadmin" ;
19
- var port = 9000 ;
20
19
21
20
var passwordParameter = ParameterResourceBuilderExtensions . CreateDefaultPasswordParameter ( distributedApplicationBuilder ,
22
21
$ "rootPassword") ;
@@ -26,8 +25,9 @@ public async Task StorageGetsCreatedAndUsable()
26
25
var minio = distributedApplicationBuilder
27
26
. AddMinioContainer ( "minio" ,
28
27
distributedApplicationBuilder . AddParameter ( "username" , rootUser ) ,
29
- rootPasswordParameter ,
30
- port : port ) ;
28
+ rootPasswordParameter ) ;
29
+
30
+ var minioEndpoint = minio . GetEndpoint ( "http" ) ;
31
31
32
32
await using var app = await distributedApplicationBuilder . BuildAsync ( ) ;
33
33
@@ -40,7 +40,7 @@ public async Task StorageGetsCreatedAndUsable()
40
40
var webApplicationBuilder = Host . CreateApplicationBuilder ( ) ;
41
41
42
42
webApplicationBuilder . Services . AddMinio ( configureClient => configureClient
43
- . WithEndpoint ( "localhost" , port )
43
+ . WithEndpoint ( "localhost" , minioEndpoint . Port )
44
44
. WithCredentials ( rootUser , passwordParameter . Value )
45
45
. WithSSL ( false )
46
46
. Build ( ) ) ;
@@ -67,31 +67,31 @@ public async Task WithDataShouldPersistStateBetweenUsages(bool useVolume)
67
67
using var builder1 = TestDistributedApplicationBuilder . Create ( testOutputHelper ) ;
68
68
69
69
var rootUser = "minioadmin" ;
70
- var port = 9000 ;
71
70
72
71
var passwordParameter = ParameterResourceBuilderExtensions . CreateDefaultPasswordParameter ( builder1 ,
73
72
$ "rootPassword") ;
74
73
builder1 . Configuration [ "Parameters:rootPassword" ] = passwordParameter . Value ;
75
74
var rootPasswordParameter = builder1 . AddParameter ( passwordParameter . Name ) ;
76
75
77
- var minio = builder1 . AddMinioContainer ( "minio" ,
76
+ var minio1 = builder1 . AddMinioContainer ( "minio" ,
78
77
builder1 . AddParameter ( "username" , rootUser ) ,
79
- rootPasswordParameter ,
80
- port : port ) ;
78
+ rootPasswordParameter ) ;
79
+
80
+ var minio1Endpoint = minio1 . GetEndpoint ( "http" ) ;
81
81
82
82
if ( useVolume )
83
83
{
84
84
// Use a deterministic volume name to prevent them from exhausting the machines if deletion fails
85
- volumeName = VolumeNameGenerator . Generate ( minio , nameof ( WithDataShouldPersistStateBetweenUsages ) ) ;
85
+ volumeName = VolumeNameGenerator . Generate ( minio1 , nameof ( WithDataShouldPersistStateBetweenUsages ) ) ;
86
86
87
87
// if the volume already exists (because of a crashing previous run), delete it
88
88
DockerUtils . AttemptDeleteDockerVolume ( volumeName , throwOnFailure : true ) ;
89
- minio . WithDataVolume ( volumeName ) ;
89
+ minio1 . WithDataVolume ( volumeName ) ;
90
90
}
91
91
else
92
92
{
93
93
bindMountPath = Directory . CreateTempSubdirectory ( ) . FullName ;
94
- minio . WithDataBindMount ( bindMountPath ) ;
94
+ minio1 . WithDataBindMount ( bindMountPath ) ;
95
95
}
96
96
97
97
using ( var app = builder1 . Build ( ) )
@@ -100,14 +100,14 @@ public async Task WithDataShouldPersistStateBetweenUsages(bool useVolume)
100
100
101
101
var rns = app . Services . GetRequiredService < ResourceNotificationService > ( ) ;
102
102
103
- await rns . WaitForResourceHealthyAsync ( minio . Resource . Name ) ;
103
+ await rns . WaitForResourceHealthyAsync ( minio1 . Resource . Name ) ;
104
104
105
105
try
106
106
{
107
107
var webApplicationBuilder = Host . CreateApplicationBuilder ( ) ;
108
108
109
109
webApplicationBuilder . Services . AddMinio ( configureClient => configureClient
110
- . WithEndpoint ( "localhost" , port )
110
+ . WithEndpoint ( "localhost" , minio1Endpoint . Port )
111
111
. WithCredentials ( rootUser , passwordParameter . Value )
112
112
. WithSSL ( false )
113
113
. Build ( ) ) ;
@@ -133,8 +133,9 @@ public async Task WithDataShouldPersistStateBetweenUsages(bool useVolume)
133
133
134
134
var minio2 = builder2 . AddMinioContainer ( "minio" ,
135
135
builder2 . AddParameter ( "username" , rootUser ) ,
136
- rootPasswordParameter2 ,
137
- port : port ) ;
136
+ rootPasswordParameter2 ) ;
137
+
138
+ var minio2Endpoint = minio2 . GetEndpoint ( "http" ) ;
138
139
139
140
if ( useVolume )
140
141
{
@@ -151,15 +152,15 @@ public async Task WithDataShouldPersistStateBetweenUsages(bool useVolume)
151
152
152
153
var rns = app . Services . GetRequiredService < ResourceNotificationService > ( ) ;
153
154
154
- await rns . WaitForResourceHealthyAsync ( minio . Resource . Name ) ;
155
+ await rns . WaitForResourceHealthyAsync ( minio1 . Resource . Name ) ;
155
156
156
157
157
158
try
158
159
{
159
160
var webApplicationBuilder = Host . CreateApplicationBuilder ( ) ;
160
161
161
162
webApplicationBuilder . Services . AddMinio ( configureClient => configureClient
162
- . WithEndpoint ( "localhost" , port )
163
+ . WithEndpoint ( "localhost" , minio2Endpoint . Port )
163
164
. WithCredentials ( rootUser , passwordParameter . Value )
164
165
. WithSSL ( false )
165
166
. Build ( ) ) ;
0 commit comments