An entry names an unpublished package with an empty version, never left out, so a run on request's candidate checks its packages as an entry's (CheckEntry), not as an ask's. Built against the SDK head aee7e4c2 (fix/47-H1-sdk-empty-pin), which goes in the same merge call.
Builds: design 47 H S8 (H-pins-spec-and-gaps item 4, L10), H-A-204
31 lines
1.0 KiB
Go
31 lines
1.0 KiB
Go
package index
|
|
|
|
import (
|
|
"strings"
|
|
"testing"
|
|
|
|
"git.novox.be/novox/mesh-delivery/modules/mesh-delivery-contracts/go/seats/meshcatalog"
|
|
)
|
|
|
|
// TestCheckCandidateModulePins: an entry's package with no published version (an empty pin) passes a run on request's
|
|
// candidate; a pin that is no version is refused (design 47 H S8, the pin specification's item 4).
|
|
func TestCheckCandidateModulePins(t *testing.T) {
|
|
for _, c := range []struct {
|
|
name string
|
|
packages map[string]string
|
|
ok bool
|
|
}{
|
|
{"an empty pin", map[string]string{"git.example/novox/lib/go": ""}, true},
|
|
{"a version", map[string]string{"git.example/novox/lib/go": "v0.1.4"}, true},
|
|
{"no version", map[string]string{"git.example/novox/lib/go": "latest"}, false},
|
|
} {
|
|
t.Run(c.name, func(t *testing.T) {
|
|
m := meshcatalog.CandidatesByGroupValuePullsItemFpsValue{Fp2: "src2:" + strings.Repeat("ab", 32), Packages: c.packages}
|
|
err := checkCandidateModule(m)
|
|
if (err == nil) != c.ok {
|
|
t.Errorf("checkCandidateModule(%v) = %v, want ok %v", c.packages, err, c.ok)
|
|
}
|
|
})
|
|
}
|
|
}
|