Ejemplo n.º 1
0
        public async Task Influx_OnFakeDbName_ShouldCreateAndDropDb()
        {
            // Arrange
            var dbName = CreateRandomDbName();

            // Act
            var createResponse = await _influx.CreateDatabaseAsync(dbName);

            var deleteResponse = await _influx.DropDatabaseAsync(dbName);

            // Assert
            createResponse.Success.Should().BeTrue();
            deleteResponse.Success.Should().BeTrue();
        }
Ejemplo n.º 2
0
        // TODO: make async
        protected override void FinalizeTestFixtureSetUp()
        {
            InfluxVersion influxVersion;
            if (!Enum.TryParse(ConfigurationManager.AppSettings.Get("version"), out influxVersion))
                influxVersion = InfluxVersion.Auto;

            _influx = new InfluxDb(
                ConfigurationManager.AppSettings.Get("url"),
                ConfigurationManager.AppSettings.Get("username"),
                ConfigurationManager.AppSettings.Get("password"),
                influxVersion);

            _influx.Should().NotBeNull();

            _dbName = CreateRandomDbName();

            //PurgeFakeDatabases();

            var createResponse = _influx.CreateDatabaseAsync(_dbName).Result;
            createResponse.Success.Should().BeTrue();

            // workaround for issue https://github.com/influxdb/influxdb/issues/3363
            // by first creating a single point in the empty db
            var writeResponse = _influx.WriteAsync(_dbName, CreateMockPoints(1));
            writeResponse.Result.Success.Should().BeTrue();
        }
Ejemplo n.º 3
0
        protected override async Task FinalizeSetUp()
        {
            //TODO: Have this injectable so it can be executed from the test server with different data
            InfluxVersion influxVersion;

            if (!Enum.TryParse(ConfigurationManager.AppSettings.Get("version"), out influxVersion))
            {
                influxVersion = InfluxVersion.Auto;
            }

            _influx = new InfluxDb(
                ConfigurationManager.AppSettings.Get("url"),
                ConfigurationManager.AppSettings.Get("username"),
                ConfigurationManager.AppSettings.Get("password"),
                influxVersion);

            _influx.Should().NotBeNull();

            _dbName = CreateRandomDbName();

            //PurgeFakeDatabases();

            var createResponse = _influx.CreateDatabaseAsync(_dbName).Result;

            createResponse.Success.Should().BeTrue();

            // workaround for issue https://github.com/influxdb/influxdb/issues/3363
            // by first creating a single point in the empty db
            var writeResponse = _influx.WriteAsync(_dbName, CreateMockPoints(1));

            writeResponse.Result.Success.Should().BeTrue();
        }
Ejemplo n.º 4
0
        public async Task Configure()
        {
            var dbs = await _influxDb.ShowDatabasesAsync();

            if (dbs.All(x => x.Name != "machinedata"))
            {
                await _influxDb.CreateDatabaseAsync("machinedata");
            }
        }
Ejemplo n.º 5
0
        public async void Create_DB_Test()
        {
            string dbName = GetNewDbName();
            InfluxDbApiCreateResponse response = await _db.CreateDatabaseAsync(dbName);

            InfluxDbApiDeleteResponse deleteResponse = await _db.DeleteDatabaseAsync(dbName);

            response.Success.Should().BeTrue();
            deleteResponse.Success.Should().BeTrue();
        }