Skip to content

Commit 8c607eb

Browse files
authored
tests: fix BrotoBuf BCcheck on version-level (#536)
Signed-off-by: Jan Kowalleck <[email protected]>
1 parent f2f4c2d commit 8c607eb

File tree

2 files changed

+16
-13
lines changed

2 files changed

+16
-13
lines changed

tools/src/test/proto/buf_breaking-version.yaml

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,4 @@
33
version: v2
44
breaking: # https://buf.build/docs/configuration/v2/buf-yaml#breaking
55
use: # see https://buf.build/docs/breaking/overview#rules-and-categories
6-
- WIRE
7-
except:
8-
# scope is to detect changes from one version to the other -> so ignore "FILE_SAME_PACKAGE"
9-
- FILE_SAME_PACKAGE
6+
- WIRE

tools/src/test/proto/test.sh

Lines changed: 15 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
#!/usr/bin/env bash
2-
set -uex
2+
set -ue
33

44
THIS_PATH="$(realpath "$(dirname "$0")")"
55
ROOT_PATH="$(realpath "${THIS_PATH}/../../../..")"
@@ -51,23 +51,29 @@ function schema-breaking-version () {
5151
function compare() {
5252
NEW="bom-${1}.proto"
5353
OLD="bom-${2}.proto"
54-
SCHEMA_DIR_OLD="${SCHEMA_DIR}_old"
54+
55+
NEW_NP="$(mktemp)"
56+
OLD_NP="$(mktemp)"
57+
58+
# remove package identifier -> so that the comparisson works as expected
59+
sed 's/^package .*//' "${ROOT_PATH}/${SCHEMA_DIR}/${NEW}" > "$NEW_NP"
60+
sed 's/^package .*//' "${ROOT_PATH}/${SCHEMA_DIR}/${OLD}" > "$OLD_NP"
5561

5662
echo ">> compare new:${NEW} -VS- old:${OLD}" >&2
5763
# stick with the original path of "$NEW", so the reporting makes sense...
5864
docker run --rm \
59-
--volume "${ROOT_PATH}/${SCHEMA_DIR}/${OLD}:/workspaces/old/${NEW}:ro" \
60-
--volume "${ROOT_PATH}/${SCHEMA_DIR}/${NEW}:/workspaces/new/${NEW}:ro" \
65+
--volume "${OLD_NP}:/workspaces/old/${NEW}:ro" \
66+
--volume "${NEW_NP}:/workspaces/new/${NEW}:ro" \
6167
--volume "${THIS_PATH}/buf_breaking-version.yaml:/workspaces/new/buf.yaml:ro" \
62-
--workdir '/workspaces' \
68+
--workdir '/workspaces/new' \
6369
bufbuild/buf:"$BUF_IMAGE_VERSION" \
64-
breaking new \
65-
--against old \
70+
breaking \
71+
--against ../old \
6672
--error-format "$LOG_FORMAT"
6773
}
6874

69-
compare '1.6' '1.5'
70-
compare '1.5' '1.4'
75+
# compare '1.6' '1.5' # <-- possible breaks are acknowledged
76+
# compare '1.5' '1.4' # <-- possible breaks are acknowledged
7177
compare '1.4' '1.3'
7278

7379
echo '>> OK.' >&2

0 commit comments

Comments
 (0)