Skip to content

Commit

Permalink
Merge pull request #587 from uber/lu.bazel
Browse files Browse the repository at this point in the history
Temporary solution to support running tests with bazel
  • Loading branch information
ChuntaoLu authored Apr 15, 2019
2 parents bf225b3 + 6fd6e4f commit 06ec349
Show file tree
Hide file tree
Showing 5 changed files with 66 additions and 11 deletions.
17 changes: 14 additions & 3 deletions codegen/template_bundle/template_files.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

15 changes: 13 additions & 2 deletions codegen/templates/service_mock.tmpl
Original file line number Diff line number Diff line change
Expand Up @@ -63,8 +63,19 @@ type mockService struct {
// - "config/test.yaml" where current dir is the project root
func MustCreateTestService(t *testing.T, testConfigPaths ...string) MockService {
if len(testConfigPaths) == 0 {
defaultPath := filepath.Join(os.Getenv("GOPATH"), "src", "{{$defaultTestConfigPath}}")
testConfigPaths = append(testConfigPaths, defaultPath)
configPath := filepath.Join("src", "{{$defaultTestConfigPath}}")
defaultPath := filepath.Join(os.Getenv("GOPATH"), configPath)

// This is a temporary solution for running tests using bazel
// see https://docs.bazel.build/versions/master/test-encyclopedia.html for relevant env vars
// TODO: need long term solution to avoid hardcoding bazel specifics
bazelPath := filepath.Join(os.Getenv("TEST_SRCDIR"), os.Getenv("TEST_WORKSPACE"), configPath)

testConfigPaths = append(
testConfigPaths,
defaultPath,
bazelPath,
)
}
c := config.NewRuntimeConfigOrDie(testConfigPaths, nil)

Expand Down

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

0 comments on commit 06ec349

Please sign in to comment.