forked from google/android-cuttlefish
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Align e2e orchestration project structure with bazel gazelle.
- BUILD files under the orchestration directory should not have contradictions with `bazel run //:gazelle`.
- Loading branch information
Showing
21 changed files
with
260 additions
and
534 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 |
---|---|---|
@@ -1,18 +1,11 @@ | ||
# e2e tests | ||
|
||
## Golang tests | ||
|
||
e2e tests are meant to be run with `bazel`, i.e `bazel test orchestration/...`. However, | ||
the tests are still buildable with the `go` tool, i.e `go test ./...` should not present | ||
any compilation erros, the execution should fail due missing data dependencies. | ||
|
||
Adding a new dependency requires updating `go.mod` as well as `bazel` relevant files. | ||
## Orchestration tests | ||
|
||
``` | ||
# 1. Update go.mod. | ||
go get <dependency> # i.e `go get github.com/google/go-cmp/cmp` | ||
# 2. Update deps.bzl | ||
bazel run //:gazelle -- update-repos -from_file=go.mod -to_macro=deps.bzl%go_dependencies | ||
# 3. Update BUILD files. | ||
bazel run //:gazelle | ||
``` | ||
|
||
``` | ||
bazel test --local_test_jobs=1 orchestration/... | ||
``` |
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 was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
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 was deleted.
Oops, something went wrong.
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,36 @@ | ||
# Copyright (C) 2024 The Android Open Source Project | ||
# | ||
# 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. | ||
|
||
load("def.bzl", "aosp_artifact") | ||
|
||
sh_binary( | ||
name = "fetch_aosp_artifact", | ||
srcs = ["fetch_aosp_artifact.sh"], | ||
) | ||
|
||
aosp_artifact( | ||
name = "cvd_host_package", | ||
artifact_name = "cvd-host_package.tar.gz", | ||
build_id = "12432601", | ||
build_target = "aosp_cf_x86_64_phone-trunk_staging-userdebug", | ||
out_name = "cvd-host_package.tar.gz", | ||
) | ||
|
||
aosp_artifact( | ||
name = "images_zip", | ||
artifact_name = "aosp_cf_x86_64_phone-img-12432601.zip", | ||
build_id = "12432601", | ||
build_target = "aosp_cf_x86_64_phone-trunk_staging-userdebug", | ||
out_name = "images.zip", | ||
) |
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,22 @@ | ||
# Copyright (C) 2024 The Android Open Source Project | ||
# | ||
# 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. | ||
|
||
def aosp_artifact(name, build_id, build_target, artifact_name, out_name): | ||
native.genrule( | ||
name = name, | ||
outs = [out_name], | ||
visibility = ["//visibility:public"], | ||
cmd = "$(location :fetch_aosp_artifact) -b "+build_id+" -t "+build_target+" -a "+artifact_name+" -o $@", | ||
tools = [":fetch_aosp_artifact"], | ||
) |
File renamed without changes.
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,29 @@ | ||
# Copyright (C) 2024 The Android Open Source Project | ||
# | ||
# 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. | ||
|
||
load("@io_bazel_rules_go//go:def.bzl", "go_library") | ||
|
||
go_library( | ||
name = "common", | ||
srcs = ["common.go"], | ||
importpath = "github.com/google/android-cuttlefish/e2etests/orchestration/common", | ||
visibility = ["//visibility:public"], | ||
deps = [ | ||
"@com_github_docker_docker//api/types", | ||
"@com_github_docker_docker//api/types/container", | ||
"@com_github_docker_docker//client", | ||
"@com_github_docker_go_connections//nat", | ||
"@com_github_google_cloud_android_orchestration//pkg/client", | ||
], | ||
) |
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
31 changes: 31 additions & 0 deletions
31
e2etests/orchestration/create_from_images_zip_test/BUILD.bazel
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,31 @@ | ||
# Copyright (C) 2024 The Android Open Source Project | ||
# | ||
# 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. | ||
|
||
load("@io_bazel_rules_go//go:def.bzl", "go_test") | ||
|
||
go_test( | ||
name = "create_from_images_zip_test_test", | ||
srcs = ["main_test.go"], | ||
data = [ | ||
"//orchestration/artifacts:cvd_host_package", | ||
"//orchestration/artifacts:images_zip", | ||
"@images//docker:orchestration_image_tar", | ||
], | ||
deps = [ | ||
"//orchestration/common", | ||
"@com_github_google_android_cuttlefish_frontend_src_liboperator//api/v1:api", | ||
"@com_github_google_cloud_android_orchestration//pkg/client", | ||
"@com_github_google_go_cmp//cmp", | ||
], | ||
) |
Oops, something went wrong.