config_test.go 791 字节
Newer Older
1 2 3 4 5 6 7 8 9 10 11 12
package config

import (
	"fmt"
	"testing"

	"github.com/BurntSushi/toml"
)

func TestDecodeConfig(t *testing.T) {
	text := `
root = "/var/local/epm"
J
jiazhiguang 已提交
13 14
db_path = "/var/local/epm/epm.db"
db_timeout = 10
15 16 17 18 19 20 21 22

[grpc]
  address = "/var/run/containerd/containerd.sock"
  uid = 0
  gid = 0
  max_recv_message_size = 16777216
  max_send_message_size = 16777216

J
jiazhiguang 已提交
23 24 25 26 27 28 29
[pools]
  [pools."bundle-cache.occlum.cache0"]
    type = "bundle-cache.occlum.cache0"
  [pools."bundle-cache.occlum.cache1"]
    type = "bundle-cache.occlum.cache1"
  [pools."bundle-cache.occlum.cache2"]
    type = "bundle-cache.occlum.cache2"
30 31 32 33 34 35 36
`

	var cfg Config
	if _, err := toml.Decode(text, &cfg); err != nil {
		t.Fatal(err)
	}

J
jiazhiguang 已提交
37
	for k, v := range cfg.EnclavePools {
38 39 40 41 42 43
		fmt.Println(k)
		fmt.Println(v.Type)
	}

	fmt.Printf("%#v", cfg)
}