public async Task <string> CreateAsync(ITestcontainersVolumeConfiguration configuration, CancellationToken ct = default)
        {
            var createParameters = new VolumesCreateParameters
            {
                Name   = configuration.Name,
                Labels = configuration.Labels.ToDictionary(item => item.Key, item => item.Value),
            };

            var name = (await this.Docker.Volumes.CreateAsync(createParameters, ct)
                        .ConfigureAwait(false)).Name;

            this.logger.DockerVolumeCreated(name);

            return(name);
        }
Exemplo n.º 2
0
 /// <summary>
 /// Initializes a new instance of the <see cref="NonExistingDockerVolume" /> class.
 /// </summary>
 /// <param name="configuration">The Testcontainers configuration.</param>
 /// <param name="logger">The logger.</param>
 public NonExistingDockerVolume(ITestcontainersVolumeConfiguration configuration, ILogger logger)
 {
     this.client        = new DockerVolumeOperations(configuration.DockerEndpointAuthConfig, logger);
     this.configuration = configuration;
 }