private async Task CreateBucketAsync() { _logger.LogInformation("Attempting to create bucket..."); var bucketManager = _cluster.Buckets; var bucketSettings = new BucketSettings { BucketType = BucketType.Couchbase, Name = _config.TargetBucket, RamQuotaMB = _config.TargetBucketRamQuotaMB }; _logger.LogInformation($"Creating bucket `{_config.TargetBucket}`..."); try { await bucketManager.CreateBucketAsync(bucketSettings); _logger.LogInformation("Bucket creation complete."); } catch (BucketExistsException) { _logger.LogInformation("already exists."); } _bucket = await _cluster.BucketAsync(_config.TargetBucket); var opts = new WaitUntilReadyOptions(); opts.DesiredState(ClusterState.Online); opts.ServiceTypes(ServiceType.KeyValue, ServiceType.Query); await _bucket.WaitUntilReadyAsync(TimeSpan.FromSeconds(30), opts); _collManager = _bucket.Collections; }
public async Task Test_WaitUntilReadyAsync_with_options(params ServiceType[] serviceTypes) { var cluster = _fixture.Cluster; var options = new WaitUntilReadyOptions() { CancellationTokenValue = CancellationToken.None, ServiceTypesValue = serviceTypes }; await cluster.WaitUntilReadyAsync(TimeSpan.FromSeconds(10), options).ConfigureAwait(false); }
public void Test_ServiceTypes_Defaults_To_All_Services() { //arrange/act var options = new WaitUntilReadyOptions(); //assert Assert.Equal(5, options.ServiceTypesValue.Count); Assert.Contains(options.ServiceTypesValue, type => type == ServiceType.KeyValue); Assert.Contains(options.ServiceTypesValue, type => type == ServiceType.Query); Assert.Contains(options.ServiceTypesValue, type => type == ServiceType.Search); Assert.Contains(options.ServiceTypesValue, type => type == ServiceType.Analytics); Assert.Contains(options.ServiceTypesValue, type => type == ServiceType.KeyValue); }
public void Can_Override_ServiceType_Defaults() { //arrange var options = new WaitUntilReadyOptions(); //act options.ServiceTypes(ServiceType.KeyValue, ServiceType.Query); //assert Assert.Equal(2, options.ServiceTypesValue.Count); Assert.Contains(options.ServiceTypesValue, type => type == ServiceType.KeyValue); Assert.Contains(options.ServiceTypesValue, type => type == ServiceType.Query); }