diff --git a/modules/mesh-delivery-sdk/publishconformance/publishconformance.go b/modules/mesh-delivery-sdk/publishconformance/publishconformance.go index 0764a9e9..826bd68b 100644 --- a/modules/mesh-delivery-sdk/publishconformance/publishconformance.go +++ b/modules/mesh-delivery-sdk/publishconformance/publishconformance.go @@ -17,6 +17,8 @@ const ( Name = "novox/example" Version = "0.1.0" Digest = "sha256:0123456789abcdef0123456789abcdef0123456789abcdef0123456789abcdef" + // Other is a digest the holder holds under the version in the case where it holds another; it does not contain Digest. + Other = "sha256:fedcba9876543210fedcba9876543210fedcba9876543210fedcba9876543210" ) // Outcome is what a holder did with a publish: whether the transfer ended with it, how many parts it asked for, the event @@ -54,13 +56,13 @@ func Run(t *testing.T, fresh func(t *testing.T) Bed) { if o.Err == nil || !strings.Contains(o.Err.Error(), "not stored") || !strings.Contains(o.Err.Error(), Digest) { t.Fatalf("a digest not held answered %+v; want the error to say not stored and name %s", o, Digest) } - if o.Event != "refused" || !strings.Contains(o.Reason, Digest) || o.Lacks != 0 || !o.Ended { + if o.Event != "refused" || !strings.Contains(o.Reason, "not stored") || !strings.Contains(o.Reason, Digest) || o.Lacks != 0 || !o.Ended { t.Errorf("a digest not held answered %+v; want refused said with the digest in its reason, ended, no part lacked", o) } }) t.Run("a publish with a digest and no parts is refused as not stored, naming the digest, when the holder holds the version under another digest", func(t *testing.T) { b := fresh(t) - b.Hold(Digest + "ff") + b.Hold(Other) o := b.Publish(Name, Version, Digest) if o.Err == nil || !strings.Contains(o.Err.Error(), "not stored") || !strings.Contains(o.Err.Error(), Digest) { t.Fatalf("another digest held answered %+v; want the error to say not stored and name %s", o, Digest)