Skip to content

Commit f51b009

Browse files
devversionalxhub
authored andcommitted
build: fix integration test size trackings not running after recent refactoring (angular#44430)
Fixes that the integration test size trackings stopped working due to the recent refactorings (switch to the rule from `@angular/dev-infra-private`). The size-tracking does not integrate very-well into Bazel and needs a better solution in the future, allowing for RBE and Windows support, but currently with the new rule/setup/structure the tracking does not validate sizes because: * The `dist/*.js` argument to the tracking script got expanded and messed up the indices. It should be passed as a literal. This now surfaced because the new rule runs commands in a shell. * The name for the size goldens were not computed properly because they were based on `ctx.attr.name`, but given the new structure, the test targets are always named `test`. PR Close angular#44430
1 parent a7c117a commit f51b009

File tree

8 files changed

+13
-14
lines changed

8 files changed

+13
-14
lines changed

integration/cli-hello-world-ivy-compat/BUILD.bazel

+1-1
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,6 @@ load("//integration:index.bzl", "ng_integration_test")
22

33
ng_integration_test(
44
name = "test",
5-
commands = "payload_size_tracking",
65
setup_chromium = True,
6+
track_payload_size = "cli-hello-world-ivy-compat",
77
)

integration/cli-hello-world-ivy-i18n/BUILD.bazel

+1-1
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,6 @@ load("//integration:index.bzl", "ng_integration_test")
22

33
ng_integration_test(
44
name = "test",
5-
commands = "payload_size_tracking",
65
setup_chromium = True,
6+
track_payload_size = "cli-hello-world-ivy-i18n",
77
)

integration/cli-hello-world-ivy-minimal/BUILD.bazel

+1-1
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,6 @@ load("//integration:index.bzl", "ng_integration_test")
22

33
ng_integration_test(
44
name = "test",
5-
commands = "payload_size_tracking",
65
setup_chromium = True,
6+
track_payload_size = "cli-hello-world-ivy-minimal",
77
)

integration/cli-hello-world-lazy/BUILD.bazel

+1-1
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,6 @@ load("//integration:index.bzl", "ng_integration_test")
22

33
ng_integration_test(
44
name = "test",
5-
commands = "payload_size_tracking",
65
setup_chromium = True,
6+
track_payload_size = "cli-hello-world-lazy",
77
)

integration/cli-hello-world/BUILD.bazel

+1-1
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,6 @@ load("//integration:index.bzl", "ng_integration_test")
22

33
ng_integration_test(
44
name = "test",
5-
commands = "payload_size_tracking",
65
setup_chromium = True,
6+
track_payload_size = "cli-hello-world",
77
)

integration/forms/BUILD.bazel

+1-1
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,6 @@ load("//integration:index.bzl", "ng_integration_test")
22

33
ng_integration_test(
44
name = "test",
5-
commands = "payload_size_tracking",
65
setup_chromium = True,
6+
track_payload_size = "forms",
77
)

integration/hello_world__closure/BUILD.bazel

+2-2
Original file line numberDiff line numberDiff line change
@@ -2,10 +2,10 @@ load("//integration:index.bzl", "ng_integration_test")
22

33
ng_integration_test(
44
name = "test",
5-
# TODO: Re-enable the payload_size_tracking command:
5+
# TODO: Re-enable size-tracking:
66
# We should define ngDevMode to false in Closure, but --define only works in the global scope.
77
# With ngDevMode not being set to false, this size tracking test provides little value but a lot of
88
# headache to continue updating the size.
9-
# commands = "payload_size_tracking",
9+
# track_payload_size = "hello_world_closure",
1010
setup_chromium = True,
1111
)

integration/index.bzl

+5-6
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,7 @@ def _ng_integration_test(name, setup_chromium = False, **kwargs):
3838
use_view_engine_packages = kwargs.pop("use_view_engine_packages", [])
3939
toolchains = kwargs.pop("toolchains", [])
4040
environment = kwargs.pop("environment", {})
41+
track_payload_size = kwargs.pop("track_payload_size", None)
4142
data = kwargs.pop("data", [])
4243

4344
data += [
@@ -56,18 +57,16 @@ def _ng_integration_test(name, setup_chromium = False, **kwargs):
5657

5758
# By default run `yarn install` followed by `yarn test` using the tools linked
5859
# into the integration tests (using the `tool_mappings` attribute).
59-
commands = [
60+
commands = kwargs.pop("commands", [
6061
"yarn install --cache-folder ./.yarn_local_cache",
6162
"yarn test",
62-
]
63-
64-
command_type = kwargs.pop("commands", "default")
63+
])
6564

66-
if command_type == "payload_size_tracking":
65+
if track_payload_size:
6766
commands += [
6867
"yarn build",
6968
# TODO: Replace the track payload-size script with a RBE and Windows-compatible script.
70-
"$(rootpath //:scripts/ci/track-payload-size.sh) %s dist/*.js true $${RUNFILES}/angular/$(rootpath //goldens:size-tracking/integration-payloads.json)" % name,
69+
"$(rootpath //:scripts/ci/track-payload-size.sh) %s 'dist/*.js' true $${RUNFILES}/angular/$(rootpath //goldens:size-tracking/integration-payloads.json)" % track_payload_size,
7170
]
7271
data += [
7372
"//goldens:size-tracking/integration-payloads.json",

0 commit comments

Comments
 (0)