-
Notifications
You must be signed in to change notification settings - Fork 86
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[WIP] Add remote bazel integration test
- Loading branch information
1 parent
1c067d2
commit f737538
Showing
4 changed files
with
77 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
load("@io_bazel_rules_go//go:def.bzl", "go_test") | ||
|
||
package(default_visibility = ["//cli:__subpackages__"]) | ||
|
||
go_test( | ||
name = "integration_test", | ||
srcs = ["remote_bazel_test.go"], | ||
exec_properties = { | ||
"test.workload-isolation-type": "firecracker", | ||
"test.recycle-runner": "true", | ||
"test.runner-recycling-key": "remote-bazel-integration", | ||
# The tests clone git repos, so make sure they have enough resources to do so | ||
"test.EstimatedComputeUnits": "4", | ||
"test.EstimatedFreeDiskBytes": "10GB", | ||
# Use an image with bazelisk installed | ||
"test.container-image": "docker://gcr.io/flame-public/rbe-ubuntu20-04-workflows@sha256:271e5e3704d861159c75b8dd6713dbe5a12272ec8ee73d17f89ed7be8026553f", | ||
"include-secrets": "true", | ||
}, | ||
deps = [ | ||
"//cli/remotebazel", | ||
"//server/testutil/testshell", | ||
"@com_github_stretchr_testify//require", | ||
], | ||
) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,38 @@ | ||
package integration_test | ||
|
||
import ( | ||
"fmt" | ||
"os" | ||
"testing" | ||
|
||
"github.com/buildbuddy-io/buildbuddy/cli/remotebazel" | ||
"github.com/buildbuddy-io/buildbuddy/server/testutil/testshell" | ||
"github.com/stretchr/testify/require" | ||
) | ||
|
||
func TestWithPublicRepo(t *testing.T) { | ||
apiKey := os.Getenv("BB_PROD_PROBER_ORG_API_KEY") | ||
fmt.Printf("Api key is %s", apiKey) | ||
// Root dir is persisted on recycled runners | ||
rootDir := "/root/workspace/remote-bazel-integration-test" | ||
err := os.Setenv("HOME", rootDir) | ||
require.NoError(t, err) | ||
|
||
err = os.MkdirAll(rootDir, 0755) | ||
require.NoError(t, err) | ||
err = os.Chdir(rootDir) | ||
require.NoError(t, err) | ||
|
||
if _, err := os.Stat(fmt.Sprintf("%s/bazel-gazelle", rootDir)); os.IsNotExist(err) { | ||
output := testshell.Run(t, rootDir, "git clone https://github.com/bazelbuild/bazel-gazelle --filter=blob:none --depth=1") | ||
require.NotContains(t, output, "fatal") | ||
} | ||
|
||
err = os.Chdir(fmt.Sprintf("%s/bazel-gazelle", rootDir)) | ||
require.NoError(t, err) | ||
|
||
// TODO: Run a server and executor locally to run this against | ||
exitCode, err := remotebazel.HandleRemoteBazel([]string{"help", fmt.Sprintf("--remote_header=x-buildbuddy-api-key=%s", apiKey)}) | ||
require.NoError(t, err) | ||
require.Equal(t, 0, exitCode) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters