Mikhail Klementev
73f5df2425
BREAKING CHANGE: kernel definition in the configuration files has switched from [[targets]] distro = { id = "Ubuntu", release = "18.04" } release_mask = ".*" to [[targets]] distro = { id = "Ubuntu", release = "18.04" } kernel = { regex = ".*" }
41 lines
778 B
Go
41 lines
778 B
Go
// Copyright 2018 Mikhail Klementev. All rights reserved.
|
|
// Use of this source code is governed by a AGPLv3 license
|
|
// (or later) that can be found in the LICENSE file.
|
|
|
|
package config
|
|
|
|
import (
|
|
"testing"
|
|
|
|
"code.dumpstack.io/tools/out-of-tree/distro"
|
|
|
|
"github.com/naoina/toml"
|
|
)
|
|
|
|
func TestMarshalUnmarshal(t *testing.T) {
|
|
artifactCfg := Artifact{
|
|
Name: "Put name here",
|
|
Type: KernelModule,
|
|
}
|
|
artifactCfg.Targets = append(artifactCfg.Targets,
|
|
Target{
|
|
Distro: distro.Distro{
|
|
ID: distro.Ubuntu,
|
|
Release: "18.04",
|
|
},
|
|
Kernel: Kernel{
|
|
Regex: ".*",
|
|
},
|
|
})
|
|
buf, err := toml.Marshal(&artifactCfg)
|
|
if err != nil {
|
|
t.Fatal(err)
|
|
}
|
|
|
|
var artifactCfgNew Artifact
|
|
err = toml.Unmarshal(buf, &artifactCfgNew)
|
|
if err != nil {
|
|
t.Fatal(err)
|
|
}
|
|
}
|