Skip to content

Commit

Permalink
Add test to check that all feature flags are boolean (#3036)
Browse files Browse the repository at this point in the history
  • Loading branch information
sustrik authored Aug 23, 2019
1 parent 53e756b commit b070422
Show file tree
Hide file tree
Showing 2 changed files with 38 additions and 1 deletion.
10 changes: 9 additions & 1 deletion go/lib/env/BUILD.bazel
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
load("@io_bazel_rules_go//go:def.bzl", "go_library")
load("@io_bazel_rules_go//go:def.bzl", "go_library", "go_test")

go_library(
name = "go_default_library",
Expand Down Expand Up @@ -30,3 +30,11 @@ go_library(
"@com_github_uber_jaeger_client_go//config:go_default_library",
],
)

go_test(
name = "go_default_test",
srcs = ["features_test.go"],
data = glob(["testdata/**"]),
embed = [":go_default_library"],
deps = ["@com_github_stretchr_testify//assert:go_default_library"],
)
29 changes: 29 additions & 0 deletions go/lib/env/features_test.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
// Copyright 2019 ETH Zurich, Anapaya Systems
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.

package env

import (
"reflect"
"testing"

"github.com/stretchr/testify/assert"
)

func TestAllFeatureFlagsShouldBeBoolean(t *testing.T) {
features := reflect.TypeOf(Features{})
for i := 0; i < features.NumField(); i++ {
assert.Equal(t, reflect.Bool, features.Field(i).Type.Kind())
}
}

0 comments on commit b070422

Please sign in to comment.