package catalogue import ( "testing" ) // The rule is about coupling, not about specificity everywhere. Naming `route` after a particular // proxy would be the same error in the other direction. func TestARoleNameIsFineWhereTheConsumerCannotTellTheDifference(t *testing.T) { for _, role := range []string{"route", "resolver", "artifact-store", "postgres-database"} { if _, err := decodeForTest([]byte(`{"module":"m","version":"1", "provides":[{"name":"` + role + `","scope":"mesh"}]}`)); err != nil { t.Errorf("providing %q was refused, and it names what a consumer actually gets: %v", role, err) } } } // Every other shape a module may declare still passes, so the check above bounds one thing. func TestTheOtherShapesAreStillAccepted(t *testing.T) { _, err := decodeForTest([]byte(`{"module":"probe","version":"1","resources":[ {"id":"d","type":"directory","path":"/var/lib/probe","mode":"0700"}, {"id":"f","type":"file","path":"/var/lib/probe/x","content":"x\n"}, {"id":"n","type":"network","name":"probe"}, {"id":"c","type":"container","name":"probe","image":"probe@sha256:` + `0000000000000000000000000000000000000000000000000000000000000000"}]}`)) if err != nil { t.Fatalf("an ordinary manifest was refused: %v", err) } }