package bootstrap import "testing" // The endpoint other machines dial defaults to the host they already dial — the broker's — on // WireGuard's port. One fact, not two that drift. func TestTheEndpointDerivesFromTheBrokerAddress(t *testing.T) { if got := derivedEndpoint("192.0.2.10:5671", 51820); got != "192.0.2.10:51820" { t.Fatalf("derived %q", got) } if got := derivedEndpoint("", 51820); got != "" { t.Fatalf("an endpoint was invented from nothing: %q", got) } } // A manifest with artifacts builds; one without does not — which is what separates postgres (a // bundle to compile) from nftables (a package and a service). func TestOnlyAManifestWithArtifactsBuilds(t *testing.T) { if !builds([]byte(`{"build":{"artifacts":[{"name":"x"}]}}`)) { t.Fatal("a manifest with artifacts was not built") } if builds([]byte(`{"resources":[{"id":"p","type":"package","package":"nftables"}]}`)) { t.Fatal("a manifest with nothing to build was built anyway") } }