test(addons): accept either refusal of an unlisted platform in the packaging contract (#12894)

The spec "refuses a platform the matrix does not enable" ran package.sh
with windows/amd64 and expected the text "not enabled". That text comes
from the matrix check. The tool now refuses windows/amd64 earlier, in
its format check, with: platform "windows/amd64" is not os/arch of
linux or darwin on amd64 or arm64. The tool still fails and writes no
layout, but the substring is gone, so the add-on packages run failed in
validate package rules.

The format check accepts only linux and darwin on amd64 and arm64, and
Tables lists and enables all four of them. No platform passes the
format check and is missing from the matrix, so the spec cannot reach
the matrix refusal. Assert that the output names the refused platform
and that it gives one of the refusal reasons of the tool. The not this
host check stays as it was.

Assisted-by: Claude:claude-sonnet-5-5 [Claude Code]

Signed-off-by: Ettore Di Giacinto <mudler@localai.io>
Co-authored-by: Ettore Di Giacinto <mudler@localai.io>
This commit is contained in:
mudler-agentandEttore Di Giacinto authored and GitHub committed 2026-10-25 08:56:29 +01:00
1 parent b12a6af72c
commit 51954f6f1b
1 file changed
+5 -3
+5 -3
View File
@@ -284,12 +284,14 @@ var _ = Describe("first-party package", func() {
})
It("refuses a platform the matrix does not enable and a missing executable of another platform", func() {
// Tables enables every platform the CI hosts run on, so the refused
// platform is one the matrix never lists.
// Tables enables every platform the tool accepts, so the refused
// platform is one the matrix never lists. The tool may refuse it in the
// format check or in the matrix check; both name the platform.
layout := filepath.Join(GinkgoT().TempDir(), "leg")
out, err := packageSh("--layout", layout, "--version", "1.0.0", "--platform", "windows/amd64", "--executable", binary)
Expect(err).To(HaveOccurred(), out)
Expect(out).To(ContainSubstring("not enabled"))
Expect(out).To(ContainSubstring("windows/amd64"))
Expect(out).To(Or(ContainSubstring("not enabled"), ContainSubstring("is not os/arch of"), ContainSubstring("not in the platform matrix")))
Expect(layout).NotTo(BeADirectory())
other := "linux/arm64"
if hostPlat == other {