bosun.org@v0.0.0-20210513094433-e25bc3e69a1f/cmd/bosun/database/test/config_test.go (about)

     1  package dbtest
     2  
     3  import (
     4  	"testing"
     5  
     6  	"bosun.org/host"
     7  	"bosun.org/util"
     8  )
     9  
    10  func TestConfigSave(t *testing.T) {
    11  	hm, err := host.NewManager(false)
    12  	if err != nil {
    13  		t.Error(err)
    14  	}
    15  	util.SetHostManager(hm)
    16  
    17  	cd := testData.Configs()
    18  
    19  	hash, err := cd.SaveTempConfig("test123")
    20  	check(t, err)
    21  
    22  	recoverd, err := cd.GetTempConfig(hash)
    23  	check(t, err)
    24  	if recoverd != "test123" {
    25  		t.Fatalf("Loaded config doesn't match: %s", recoverd)
    26  	}
    27  }