config_test.go 556 字节
Newer Older
S
stormgbs 已提交
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32
package config

import (
	"fmt"
	"testing"

	"github.com/BurntSushi/toml"
)

func TestDecodeConfig(t *testing.T) {
	text := `log_level = "debug" # "debug" "info" "warn" "error"

sgx_tool_sign = "/opt/intel/sgxsdk/bin/x64/sgx_sign"

[containerd]
    socket = "/run/containerd/containerd.sock"

[enclave_runtime]

    [enclave_runtime.occlum]
        build_image = "docker.io/occlum/occlum:0.12.0-ubuntu18.04"

    [enclave_runtime.graphene]
`

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

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