Skip to content

Commit 5e62d8f

Browse files
xiangu-batwhoe-jo
authored andcommitted
Integration Test Framework for Validation
1 parent ef4f686 commit 5e62d8f

33 files changed

Lines changed: 978 additions & 0 deletions
Lines changed: 58 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,58 @@
1+
# *******************************************************************************
2+
# Copyright (c) 2026 Contributors to the Eclipse Foundation
3+
#
4+
# See the NOTICE file(s) distributed with this work for additional
5+
# information regarding copyright ownership.
6+
#
7+
# This program and the accompanying materials are made available under the
8+
# terms of the Apache License Version 2.0 which is available at
9+
# https://www.apache.org/licenses/LICENSE-2.0
10+
#
11+
# SPDX-License-Identifier: Apache-2.0
12+
# *******************************************************************************
13+
14+
load("@rules_rust//rust:defs.bzl", "rust_library", "rust_test")
15+
16+
filegroup(
17+
name = "bazel_component_test_data",
18+
srcs = [
19+
"//validation/core/integration_test/bazel_component/negative_extra_component:case_data",
20+
"//validation/core/integration_test/bazel_component/negative_extra_unit:case_data",
21+
"//validation/core/integration_test/bazel_component/negative_missing_component:case_data",
22+
"//validation/core/integration_test/bazel_component/negative_missing_unit:case_data",
23+
"//validation/core/integration_test/bazel_component/negative_wrong_stereotype:case_data",
24+
"//validation/core/integration_test/bazel_component/positive_case_insensitive:case_data",
25+
"//validation/core/integration_test/bazel_component/positive_component:case_data",
26+
],
27+
)
28+
29+
rust_library(
30+
name = "test_framework",
31+
srcs = [
32+
"src/lib.rs",
33+
"src/test_framework.rs",
34+
],
35+
crate_root = "src/lib.rs",
36+
visibility = ["//validation/core:__subpackages__"],
37+
deps = [
38+
"//validation/core:validation",
39+
"@crates//:serde",
40+
"@crates//:serde_json",
41+
],
42+
)
43+
44+
rust_test(
45+
name = "bazel_component_integration_test",
46+
srcs = ["src/bazel_component_suite.rs"],
47+
crate_root = "src/bazel_component_suite.rs",
48+
data = [
49+
":bazel_component_test_data",
50+
"//validation/core:validation_cli",
51+
],
52+
deps = [
53+
":test_framework",
54+
"//validation/core:validation",
55+
"@crates//:serde",
56+
"@crates//:serde_json",
57+
],
58+
)
Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
1+
# *******************************************************************************
2+
# Copyright (c) 2026 Contributors to the Eclipse Foundation
3+
#
4+
# See the NOTICE file(s) distributed with this work for additional
5+
# information regarding copyright ownership.
6+
#
7+
# This program and the accompanying materials are made available under the
8+
# terms of the Apache License Version 2.0 which is available at
9+
# https://www.apache.org/licenses/LICENSE-2.0
10+
#
11+
# SPDX-License-Identifier: Apache-2.0
12+
# *******************************************************************************
13+
14+
load("//bazel/rules/rules_score:rules_score.bzl", "architectural_design")
15+
load("//validation/core/integration_test:puml_fixture.bzl", "provider_fbs_fixture_bundle")
16+
17+
architectural_design(
18+
name = "design",
19+
static = ["component_diagram.puml"],
20+
visibility = ["//visibility:private"],
21+
)
22+
23+
provider_fbs_fixture_bundle(
24+
name = "fbs",
25+
visibility = ["//visibility:public"],
26+
deps = [":design"],
27+
)
28+
29+
filegroup(
30+
name = "case_data",
31+
srcs = [
32+
"architecture.json",
33+
"expected.json",
34+
":fbs",
35+
],
36+
visibility = ["//visibility:public"],
37+
)
Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
{
2+
"components": {
3+
"safety_software_seooc_example": {
4+
"units": [],
5+
"components": [
6+
"@//bazel/rules/rules_score/examples/seooc:component_example"
7+
]
8+
},
9+
"@//bazel/rules/rules_score/examples/seooc:component_example": {
10+
"units": [
11+
"@//bazel/rules/rules_score/examples/seooc/unit_1:unit_1",
12+
"@//bazel/rules/rules_score/examples/seooc/unit_2:unit_2"
13+
],
14+
"components": []
15+
}
16+
}
17+
}
Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
' *******************************************************************************
2+
' Copyright (c) 2026 Contributors to the Eclipse Foundation
3+
'
4+
' See the NOTICE file(s) distributed with this work for additional
5+
' information regarding copyright ownership.
6+
'
7+
' This program and the accompanying materials are made available under the
8+
' terms of the Apache License Version 2.0 which is available at
9+
' https://www.apache.org/licenses/LICENSE-2.0
10+
'
11+
' SPDX-License-Identifier: Apache-2.0
12+
' *******************************************************************************
13+
14+
@startuml component_diagram
15+
16+
package "Sample Seooc" as safety_software_seooc_example <<SEooC>> {
17+
component "Component Example" as component_example <<component>> {
18+
component "Unit 1" as unit_1 <<unit>>
19+
component "Unit 2" as unit_2 <<unit>>
20+
}
21+
22+
component "Extra Component" as extra_component <<component>>
23+
}
24+
25+
@enduml
Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
{
2+
"should_pass": false,
3+
"error_contains": [
4+
"Extra component in PlantUML not in Bazel",
5+
"Alias : \"extra_component\""
6+
]
7+
}
Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
1+
# *******************************************************************************
2+
# Copyright (c) 2026 Contributors to the Eclipse Foundation
3+
#
4+
# See the NOTICE file(s) distributed with this work for additional
5+
# information regarding copyright ownership.
6+
#
7+
# This program and the accompanying materials are made available under the
8+
# terms of the Apache License Version 2.0 which is available at
9+
# https://www.apache.org/licenses/LICENSE-2.0
10+
#
11+
# SPDX-License-Identifier: Apache-2.0
12+
# *******************************************************************************
13+
14+
load("//bazel/rules/rules_score:rules_score.bzl", "architectural_design")
15+
load("//validation/core/integration_test:puml_fixture.bzl", "provider_fbs_fixture_bundle")
16+
17+
architectural_design(
18+
name = "design",
19+
static = ["component_diagram.puml"],
20+
visibility = ["//visibility:private"],
21+
)
22+
23+
provider_fbs_fixture_bundle(
24+
name = "fbs",
25+
visibility = ["//visibility:public"],
26+
deps = [":design"],
27+
)
28+
29+
filegroup(
30+
name = "case_data",
31+
srcs = [
32+
"architecture.json",
33+
"expected.json",
34+
":fbs",
35+
],
36+
visibility = ["//visibility:public"],
37+
)
Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
{
2+
"components": {
3+
"safety_software_seooc_example": {
4+
"units": [],
5+
"components": [
6+
"@//bazel/rules/rules_score/examples/seooc:component_example"
7+
]
8+
},
9+
"@//bazel/rules/rules_score/examples/seooc:component_example": {
10+
"units": [
11+
"@//bazel/rules/rules_score/examples/seooc/unit_1:unit_1",
12+
"@//bazel/rules/rules_score/examples/seooc/unit_2:unit_2"
13+
],
14+
"components": []
15+
}
16+
}
17+
}
Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
' *******************************************************************************
2+
' Copyright (c) 2026 Contributors to the Eclipse Foundation
3+
'
4+
' See the NOTICE file(s) distributed with this work for additional
5+
' information regarding copyright ownership.
6+
'
7+
' This program and the accompanying materials are made available under the
8+
' terms of the Apache License Version 2.0 which is available at
9+
' https://www.apache.org/licenses/LICENSE-2.0
10+
'
11+
' SPDX-License-Identifier: Apache-2.0
12+
' *******************************************************************************
13+
14+
@startuml component_diagram
15+
16+
package "Sample Seooc" as safety_software_seooc_example <<SEooC>> {
17+
component "Component Example" as component_example <<component>> {
18+
component "Unit 1" as unit_1 <<unit>>
19+
component "Unit 2" as unit_2 <<unit>>
20+
component "Unit 3" as unit_3 <<unit>>
21+
}
22+
}
23+
24+
@enduml
Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
{
2+
"should_pass": false,
3+
"error_contains": [
4+
"Extra unit in PlantUML not in Bazel",
5+
"Alias : \"unit_3\""
6+
]
7+
}
Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
1+
# *******************************************************************************
2+
# Copyright (c) 2026 Contributors to the Eclipse Foundation
3+
#
4+
# See the NOTICE file(s) distributed with this work for additional
5+
# information regarding copyright ownership.
6+
#
7+
# This program and the accompanying materials are made available under the
8+
# terms of the Apache License Version 2.0 which is available at
9+
# https://www.apache.org/licenses/LICENSE-2.0
10+
#
11+
# SPDX-License-Identifier: Apache-2.0
12+
# *******************************************************************************
13+
14+
load("//bazel/rules/rules_score:rules_score.bzl", "architectural_design")
15+
load("//validation/core/integration_test:puml_fixture.bzl", "provider_fbs_fixture_bundle")
16+
17+
architectural_design(
18+
name = "design",
19+
static = ["component_diagram.puml"],
20+
visibility = ["//visibility:private"],
21+
)
22+
23+
provider_fbs_fixture_bundle(
24+
name = "fbs",
25+
visibility = ["//visibility:public"],
26+
deps = [":design"],
27+
)
28+
29+
filegroup(
30+
name = "case_data",
31+
srcs = [
32+
"architecture.json",
33+
"expected.json",
34+
":fbs",
35+
],
36+
visibility = ["//visibility:public"],
37+
)

0 commit comments

Comments
 (0)