MCPcopy
hub / github.com/perkeep/perkeep / TestExpansionsInHighlevelConfig

Function TestExpansionsInHighlevelConfig

pkg/serverinit/serverinit_test.go:249–277  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

247}
248
249func TestExpansionsInHighlevelConfig(t *testing.T) {
250 srcRoot, err := osutil.PkSourceRoot()
251 if err != nil {
252 t.Fatalf("source root folder not found: %v", err)
253 }
254 const keyID = "26F5ABDA"
255 t.Setenv("TMP_EXPANSION_TEST", keyID)
256 t.Setenv("TMP_EXPANSION_SECRING", filepath.Join(srcRoot, filepath.FromSlash("pkg/jsonsign/testdata/test-secring.gpg")))
257 // Setting CAMLI_CONFIG_DIR to avoid triggering failInTests in osutil.PerkeepConfigDir
258 t.Setenv("CAMLI_CONFIG_DIR", "whatever")
259 conf, err := serverinit.Load([]byte(`
260{
261 "auth": "localhost",
262 "listen": ":4430",
263 "https": false,
264 "identity": ["_env", "${TMP_EXPANSION_TEST}"],
265 "identitySecretRing": ["_env", "${TMP_EXPANSION_SECRING}"],
266 "googlecloudstorage": ":camlistore-dev-blobs",
267 "kvIndexFile": "/tmp/camli-index.kvdb"
268}
269`))
270 if err != nil {
271 t.Fatal(err)
272 }
273 got := fmt.Sprintf("%#v", conf)
274 if !strings.Contains(got, keyID) {
275 t.Errorf("Expected key %s in resulting low-level config. Got: %s", keyID, got)
276 }
277}
278
279func TestInstallHandlers(t *testing.T) {
280 srcRoot, err := osutil.PkSourceRoot()

Callers

nothing calls this directly

Calls 5

PkSourceRootFunction · 0.92
LoadFunction · 0.92
FatalMethod · 0.80
ContainsMethod · 0.80
FatalfMethod · 0.65

Tested by

no test coverage detected