carlos / platform Public

Clone
git clone https://amadan.net/carlos/platform

Plain git — no account needed to clone.

Download

Download this file

1package host
2
3import "testing"
4
5func TestActivationUnitSettings(t *testing.T) {
6 for _, raw := range []string{"CARLOS_HOST_CLAIM=1\n", "CARLOS_HOST_CLAIM='0'\nCARLOS_DATA_DIR=/data\n"} {
7 cfg, err := activationUnitSettings([]byte(raw))
8 if err != nil || !cfg.enabled || cfg.data != "/data" {
9 t.Fatalf("%q: %+v %v", raw, cfg, err)
10 }
11 }
12 for _, raw := range []string{"", "CARLOS_HOST_CLAIM=\n", "CARLOS_HOST_CLAIM=1\nBROKEN", "CARLOS_HOST_CLAIM=1\nCARLOS_DATA_DIR=relative\n", "CARLOS_HOST_CLAIM=1\nCARLOS_DATA_DIR=/data\nCARLOS_DATA_DIR=/elsewhere\n", "CARLOS_HOST_CLAIM=1\nCARLOS_REGION=ie\n", "CARLOS_HOST_CLAIM=1\nCARLOS_OPT_DIR=\"/opt\n", "export CARLOS_HOST_CLAIM=1\n"} {
13 if _, err := activationUnitSettings([]byte(raw)); err == nil {
14 t.Fatalf("accepted %q", raw)
15 }
16 }
17}
18