package catalogue import ( "testing" ) // Where the answer to a requirement is allowed to live. // // A shell, a display server and a private network have to be on the machine that needs them. A // database does not — it runs somewhere and is reached over the network. Both were written // `requires`, so both were answered the same way, and the second answer was to install PostgreSQL // on every machine that runs a web application. // onNetwork is a set of providers, all of them reachable. Written as a helper because a machine // that cannot reach the one answering its requirement is its own case, tested separately. // reachable is this machine, on the private network. func reachable() Node { n := workstation() n.At = "workstation.internal" return n } func TestTheShortFormStillMeansHere(t *testing.T) { // `"provides": ["shell"]` must keep meaning what it meant, or every existing manifest // silently changes meaning. m, err := decodeForTest([]byte(`{"module":"zsh","version":"1","provides":["shell"]}`)) if err != nil { t.Fatal(err) } if len(m.Provides) != 1 || m.Provides[0].At() != ScopeNode { t.Fatalf("a plain name is no longer node-scoped: %v", m.Provides) } } // Being told, which is the difference between knowing and being able to.