@@ -114,7 +114,7 @@ impl ContainerBuilder {
114
114
Ok ( Container {
115
115
internal_port : self . internal_port ,
116
116
api_token : self . api_token . clone ( ) ,
117
- container : GenericImage :: new ( self . image_name , self . image_tag )
117
+ instance : GenericImage :: new ( self . image_name , self . image_tag )
118
118
. with_exposed_port ( self . internal_port )
119
119
. with_wait_for ( WaitFor :: Http ( Box :: new (
120
120
HttpWaitStrategy :: new ( "/api/v1/ping" )
@@ -137,10 +137,10 @@ impl ContainerBuilder {
137
137
}
138
138
139
139
/// A running test container for the [EventSourcingDB](https://www.eventsourcingdb.io/).
140
- ///
140
+ ///
141
141
/// Aside from managing the container, this struct also provides methods to get the data needed to connect to
142
142
/// the database or even a fully configured client.
143
- ///
143
+ ///
144
144
/// You'll most likely want to use the [`Container::start_default`] method to create a new container instance for your tests.
145
145
/// For more details, see the [`crate::container`] module documentation.
146
146
/// ```
@@ -152,7 +152,7 @@ impl ContainerBuilder {
152
152
/// ```
153
153
#[ derive( Debug ) ]
154
154
pub struct Container {
155
- container : ContainerAsync < GenericImage > ,
155
+ instance : ContainerAsync < GenericImage > ,
156
156
internal_port : ContainerPort ,
157
157
api_token : String ,
158
158
}
@@ -167,7 +167,7 @@ impl Container {
167
167
}
168
168
169
169
/// Shortcut method to start the container with default settings.
170
- ///
170
+ ///
171
171
/// This is the same as calling [`Container::builder`] and then [`ContainerBuilder::start`].
172
172
/// In most cases this will create a contaienr with the latest image tag and a working configuration.
173
173
///
@@ -178,26 +178,23 @@ impl Container {
178
178
}
179
179
180
180
/// Get the host of the container.
181
- ///
181
+ ///
182
182
/// This is the host that you can use to connect to the database. In most cases this will be `localhost`.
183
183
///
184
184
/// # Errors
185
185
/// This function will return an error if the container is not running (e.g. because it crashed) or if the host could not be retrieved
186
186
pub async fn get_host ( & self ) -> Result < Host , ContainerError > {
187
- Ok ( self . container . get_host ( ) . await ?)
187
+ Ok ( self . instance . get_host ( ) . await ?)
188
188
}
189
189
190
190
/// Get the mapped port for the database.
191
- ///
191
+ ///
192
192
/// This is the port that you can use to connect to the database. This will be a random port that is mapped to the internal port configured via [`ContainerBuilder::with_port`].
193
193
///
194
194
/// # Errors
195
195
/// This function will return an error if the container is not running (e.g. because it crashed) or if the host could not be retrieved
196
196
pub async fn get_mapped_port ( & self ) -> Result < u16 , ContainerError > {
197
- Ok ( self
198
- . container
199
- . get_host_port_ipv4 ( self . internal_port )
200
- . await ?)
197
+ Ok ( self . instance . get_host_port_ipv4 ( self . internal_port ) . await ?)
201
198
}
202
199
203
200
/// Get the complete http base URL for the database.
@@ -227,7 +224,7 @@ impl Container {
227
224
/// # Errors
228
225
/// This function will return an error if the container could not be stopped.
229
226
pub async fn stop ( self ) -> Result < ( ) , ContainerError > {
230
- self . container . stop ( ) . await ?;
227
+ self . instance . stop ( ) . await ?;
231
228
Ok ( ( ) )
232
229
}
233
230
0 commit comments