@@ -8,7 +8,7 @@ setup() {
88
99 # Setup environment
1010 export BUILDKITE=true
11- export BUILDKITE_PLUGIN_BAZEL_BEP_ANNOTATE_SKIP_IF_NO_BEP =false
11+ export BUILDKITE_PLUGIN_BAZEL_ANNOTATE_SKIP_IF_NO_BEP =false
1212
1313 # Mock the process_bep function to avoid relying on external tools
1414 cat > " $TEMP_DIR /mock-bazel-bep.bash" << 'EOF '
@@ -21,6 +21,8 @@ process_bep() {
2121 echo "Mock processing BEP file: $BEP_FILE"
2222 if [[ -f "$BEP_FILE" ]]; then
2323 echo "Mock BEP file exists, processing successful"
24+ # Call create_annotation after successful processing
25+ create_annotation "info" "This is a mock summary"
2426 return 0
2527 else
2628 echo "Mock BEP file does not exist"
@@ -31,7 +33,7 @@ process_bep() {
3133create_annotation() {
3234 local style="$1"
3335 local content="$2"
34- echo "Mock annotation created with style: $style"
36+ echo "Mock annotation created with style: $style and append flag enabled "
3537}
3638EOF
3739
@@ -115,7 +117,7 @@ teardown() {
115117
116118@test " Skip when no BEP file and skip option is enabled" {
117119 # No BEP file, but we'll enable skip option
118- export BUILDKITE_PLUGIN_BAZEL_BEP_ANNOTATE_SKIP_IF_NO_BEP =true
120+ export BUILDKITE_PLUGIN_BAZEL_ANNOTATE_SKIP_IF_NO_BEP =true
119121
120122 # Ensure no common files exist
121123 rm -f " ${BUILDKITE_BUILD_CHECKOUT_PATH:- $PWD } /bazel-events.json" || true
@@ -130,7 +132,7 @@ teardown() {
130132
131133@test " Fail when no BEP file and skip option is disabled" {
132134 # No BEP file, skip option disabled
133- export BUILDKITE_PLUGIN_BAZEL_BEP_ANNOTATE_SKIP_IF_NO_BEP =false
135+ export BUILDKITE_PLUGIN_BAZEL_ANNOTATE_SKIP_IF_NO_BEP =false
134136
135137 # Ensure no common files exist
136138 rm -f " ${BUILDKITE_BUILD_CHECKOUT_PATH:- $PWD } /bazel-events.json" || true
@@ -146,7 +148,7 @@ teardown() {
146148@test " Process BEP file when explicitly provided" {
147149 # Create a sample BEP file
148150 touch " $TEMP_DIR /sample.bep"
149- export BUILDKITE_PLUGIN_BAZEL_BEP_ANNOTATE_BEP_FILE =" $TEMP_DIR /sample.bep"
151+ export BUILDKITE_PLUGIN_BAZEL_ANNOTATE_BEP_FILE =" $TEMP_DIR /sample.bep"
150152
151153 run " $TEMP_DIR /hooks/post-command"
152154
@@ -173,11 +175,22 @@ teardown() {
173175
174176@test " Skip when BEP file doesn't exist and skip is enabled" {
175177 # Reference a non-existent BEP file with skip enabled
176- export BUILDKITE_PLUGIN_BAZEL_BEP_ANNOTATE_BEP_FILE =" $TEMP_DIR /nonexistent.bep"
177- export BUILDKITE_PLUGIN_BAZEL_BEP_ANNOTATE_SKIP_IF_NO_BEP =true
178+ export BUILDKITE_PLUGIN_BAZEL_ANNOTATE_BEP_FILE =" $TEMP_DIR /nonexistent.bep"
179+ export BUILDKITE_PLUGIN_BAZEL_ANNOTATE_SKIP_IF_NO_BEP =true
178180
179181 run " $TEMP_DIR /hooks/post-command"
180182
181183 assert_success
182184 assert_output --partial " BEP file not found at '$TEMP_DIR /nonexistent.bep' and skip_if_no_bep is true"
183185}
186+
187+ @test " Verify annotations are created with append flag" {
188+ # Create a sample BEP file
189+ touch " $TEMP_DIR /sample.bep"
190+ export BUILDKITE_PLUGIN_BAZEL_ANNOTATE_BEP_FILE=" $TEMP_DIR /sample.bep"
191+
192+ run " $TEMP_DIR /hooks/post-command"
193+
194+ assert_success
195+ assert_output --partial " Mock annotation created with style: info and append flag enabled"
196+ }
0 commit comments