|
| 1 | +/* |
| 2 | +Copyright 2018 Iguazio Systems Ltd. |
| 3 | +
|
| 4 | +Licensed under the Apache License, Version 2.0 (the "License") with |
| 5 | +an addition restriction as set forth herein. You may not use this |
| 6 | +file except in compliance with the License. You may obtain a copy of |
| 7 | +the License at http://www.apache.org/licenses/LICENSE-2.0. |
| 8 | +
|
| 9 | +Unless required by applicable law or agreed to in writing, software |
| 10 | +distributed under the License is distributed on an "AS IS" BASIS, |
| 11 | +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or |
| 12 | +implied. See the License for the specific language governing |
| 13 | +permissions and limitations under the License. |
| 14 | +
|
| 15 | +In addition, you may not use the software for any purposes that are |
| 16 | +illegal under applicable law, and the grant of the foregoing license |
| 17 | +under the Apache 2.0 license is conditioned upon your compliance with |
| 18 | +such restriction. |
| 19 | +*/ |
| 20 | + |
| 21 | +package tsdbctl |
| 22 | + |
| 23 | +import ( |
| 24 | + "github.com/stretchr/testify/suite" |
| 25 | + "github.com/v3io/v3io-tsdb/pkg/config" |
| 26 | + "testing" |
| 27 | +) |
| 28 | + |
| 29 | +type testSuite struct { |
| 30 | + suite.Suite |
| 31 | +} |
| 32 | + |
| 33 | +func (suite *testSuite) TestPopulateConfigWithTenant() { |
| 34 | + rc := RootCommandeer{v3ioPath: "Vel@Odar:p455w0rd@localhost:80123/123"} |
| 35 | + cfg := &config.V3ioConfig{ |
| 36 | + Path: "/x/y/z", |
| 37 | + } |
| 38 | + |
| 39 | + err := rc.populateConfig(cfg) |
| 40 | + |
| 41 | + expectedRc := RootCommandeer{ |
| 42 | + v3iocfg: cfg, |
| 43 | + v3ioPath: "localhost:80123/123", |
| 44 | + } |
| 45 | + expectedCfg := &config.V3ioConfig{ |
| 46 | + V3ioUrl: "localhost:80123", |
| 47 | + Container: "123", |
| 48 | + Path: "/x/y/z", |
| 49 | + Username: "Vel@Odar", |
| 50 | + Password: "p455w0rd", |
| 51 | + } |
| 52 | + |
| 53 | + suite.Require().Nil(err) |
| 54 | + suite.Require().Equal(expectedCfg, rc.v3iocfg) |
| 55 | + suite.Require().Equal(expectedRc, rc) |
| 56 | +} |
| 57 | + |
| 58 | +func TestBuilderSuite(t *testing.T) { |
| 59 | + suite.Run(t, new(testSuite)) |
| 60 | +} |
0 commit comments