@@ -7,11 +7,6 @@ namespace DotNet.Testcontainers.Configurations.Modules.Databases
7
7
8
8
public class AzuriteTestcontainerConfiguration : IDisposable
9
9
{
10
- /// <summary>
11
- /// Default Azurite docker image.
12
- /// </summary>
13
- public const string DefaultAzuriteImage = "mcr.microsoft.com/azure-storage/azurite:3.18.0" ;
14
-
15
10
/// <summary>
16
11
/// Default Blob service listening port. Default is 10000.
17
12
/// </summary>
@@ -27,6 +22,16 @@ public class AzuriteTestcontainerConfiguration : IDisposable
27
22
/// </summary>
28
23
public const int DefaultTablePort = 10002 ;
29
24
25
+ internal const string DefaultBlobEndpoint = "0.0.0.0" ;
26
+ internal const string DefaultQueueEndpoint = "0.0.0.0" ;
27
+ internal const string DefaultTableEndpoint = "0.0.0.0" ;
28
+
29
+ private const string DefaultAzuriteImage = "mcr.microsoft.com/azure-storage/azurite:3.18.0" ;
30
+
31
+ private bool runBlobOnly ;
32
+ private bool runQueueOnly ;
33
+ private bool runTableOnly ;
34
+
30
35
/// <summary>
31
36
/// Initializes a new instance of the <see cref="AzuriteTestcontainerConfiguration" /> class with default Azurite image.
32
37
/// </summary>
@@ -62,6 +67,26 @@ protected AzuriteTestcontainerConfiguration(string image)
62
67
[ PublicAPI ]
63
68
public int BlobPort { get ; set ; }
64
69
70
+ /// <summary>
71
+ /// Gets or sets a value indicating whether Blob service should run standalone.
72
+ /// </summary>
73
+ /// <remarks>
74
+ /// Default value is false.
75
+ /// </remarks>
76
+ [ PublicAPI ]
77
+ public bool RunBlobOnly
78
+ {
79
+ get => this . runBlobOnly ;
80
+ set
81
+ {
82
+ this . runBlobOnly = value ;
83
+ if ( value )
84
+ {
85
+ this . RunQueueOnly = this . RunTableOnly = false ;
86
+ }
87
+ }
88
+ }
89
+
65
90
/// <summary>
66
91
/// Gets or sets the host Queue port.
67
92
/// </summary>
@@ -71,6 +96,26 @@ protected AzuriteTestcontainerConfiguration(string image)
71
96
[ PublicAPI ]
72
97
public int QueuePort { get ; set ; }
73
98
99
+ /// <summary>
100
+ /// Gets or sets a value indicating whether Queue service should run standalone.
101
+ /// </summary>
102
+ /// <remarks>
103
+ /// Default value is false.
104
+ /// </remarks>
105
+ [ PublicAPI ]
106
+ public bool RunQueueOnly
107
+ {
108
+ get => this . runQueueOnly ;
109
+ set
110
+ {
111
+ this . runQueueOnly = value ;
112
+ if ( value )
113
+ {
114
+ this . RunBlobOnly = this . RunTableOnly = false ;
115
+ }
116
+ }
117
+ }
118
+
74
119
/// <summary>
75
120
/// Gets or sets the host Table port.
76
121
/// </summary>
@@ -80,6 +125,32 @@ protected AzuriteTestcontainerConfiguration(string image)
80
125
[ PublicAPI ]
81
126
public int TablePort { get ; set ; }
82
127
128
+ /// <summary>
129
+ /// Gets or sets a value indicating whether Table service should run standalone.
130
+ /// </summary>
131
+ /// <remarks>
132
+ /// Default value is false.
133
+ /// </remarks>
134
+ [ PublicAPI ]
135
+ public bool RunTableOnly
136
+ {
137
+ get => this . runTableOnly ;
138
+ set
139
+ {
140
+ this . runTableOnly = value ;
141
+ if ( value )
142
+ {
143
+ this . RunBlobOnly = this . RunQueueOnly = false ;
144
+ }
145
+ }
146
+ }
147
+
148
+ /// <summary>
149
+ /// Gets a value indicating whether all Azurite service will run.
150
+ /// </summary>
151
+ [ PublicAPI ]
152
+ public bool RunAllServices => ! this . RunBlobOnly && ! this . RunQueueOnly && ! this . RunTableOnly ;
153
+
83
154
/// <summary>
84
155
/// Gets the environment configuration.
85
156
/// </summary>
@@ -103,10 +174,17 @@ protected AzuriteTestcontainerConfiguration(string image)
103
174
/// Uses <see cref="Wait.ForUnixContainer" /> and waits for Azurite ports.
104
175
/// </remarks>
105
176
[ PublicAPI ]
106
- public IWaitForContainerOS WaitStrategy => Wait . ForUnixContainer ( )
107
- . UntilPortIsAvailable ( DefaultBlobPort )
108
- . UntilPortIsAvailable ( DefaultQueuePort )
109
- . UntilPortIsAvailable ( DefaultTablePort ) ;
177
+ public IWaitForContainerOS WaitStrategy
178
+ {
179
+ get
180
+ {
181
+ var waitStrategy = Wait . ForUnixContainer ( ) ;
182
+ waitStrategy = this . RunBlobOnly || this . RunAllServices ? waitStrategy . UntilPortIsAvailable ( DefaultBlobPort ) : waitStrategy ;
183
+ waitStrategy = this . RunQueueOnly || this . RunAllServices ? waitStrategy . UntilPortIsAvailable ( DefaultQueuePort ) : waitStrategy ;
184
+ waitStrategy = this . RunTableOnly || this . RunAllServices ? waitStrategy . UntilPortIsAvailable ( DefaultTablePort ) : waitStrategy ;
185
+ return waitStrategy ;
186
+ }
187
+ }
110
188
111
189
/// <inheritdoc />
112
190
public void Dispose ( )
0 commit comments