func loadTestKMLData(t *testing.T) (kml.KeyManager, string) {
	var local kml.KeyManagerLocal
	_, path, _, _ := runtime.Caller(0)
	realPath := filepath.Join(filepath.Dir(path), "testdata")

	l, err := local.New(realPath)
	assert.Nil(t, err, "Fail to setup a local test key manager")

	return l, realPath
}
func TestKMLBasic(t *testing.T) {
	var local kml.KeyManagerLocal

	validURL := "/tmp/containerops_km_cache"
	ok := local.Supported(validURL)
	assert.Equal(t, ok, true, "Fail to get supported status")
	ok = local.Supported("localInvalid://tmp/containerops_km_cache")
	assert.Equal(t, ok, false, "Fail to get supported status")

	_, err := local.New(validURL)
	assert.Nil(t, err, "Fail to setup a local key manager")
}
func TestKMLGetPublicKey(t *testing.T) {
	tmpPath, err := ioutil.TempDir("", "us-test-")
	defer os.RemoveAll(tmpPath)
	assert.Nil(t, err, "Fail to create temp dir")

	var local kml.KeyManagerLocal
	l, err := local.New(tmpPath)
	assert.Nil(t, err, "Fail to setup a local test key manager")

	namespace := "containerops"
	_, err = l.GetPublicKey("app/v1", namespace)
	assert.Nil(t, err, "Fail to get public key")
}