func TestSLPutDelete(t *testing.T) {
	tmpPath, err := ioutil.TempDir("", "us-test-")
	defer os.RemoveAll(tmpPath)
	assert.Nil(t, err, "Fail to create temp dir")

	proto := "app/v1"
	testData := "this is test DATA, you can put in anything here"

	var local sl.UpdateServiceStorageLocal
	l, err := local.New(tmpPath, tmpPath)
	assert.Nil(t, err, "Fail to setup local repo")

	invalidKey := "containerops/official"
	_, err = l.Put(proto, invalidKey, []byte(testData), utils.EncryptNone)
	assert.NotNil(t, err, "Fail to put with invalid key")

	validKey := "containerops/official/os/arch/appA"
	_, err = l.Put(proto, validKey, []byte(testData), utils.EncryptNone)
	assert.Nil(t, err, "Fail to put key")

	_, err = l.GetMeta(proto, "containerops/official")
	assert.Nil(t, err, "Fail to get meta data")

	getData, err := l.Get(proto, validKey)
	assert.Nil(t, err, "Fail to load file")
	assert.Equal(t, string(getData), testData, "Fail to get correct file")

	err = l.Delete(proto, validKey)
	assert.Nil(t, err, "Fail to remove a file")
	err = l.Delete(proto, validKey)
	assert.NotNil(t, err, "Should return error in removing a non exist file")
}
func loadSLTestData(t *testing.T) sl.UpdateServiceStorage {
	var local sl.UpdateServiceStorageLocal

	_, path, _, _ := runtime.Caller(0)
	topPath := filepath.Join(filepath.Dir(path), "testdata")
	// In this test, storage dir and key manager dir is the same
	l, err := local.New(topPath, topPath)
	assert.Nil(t, err, "Fail to setup a local test storage")

	return l
}
// TestBasic
func TestSLBasic(t *testing.T) {
	var local sl.UpdateServiceStorageLocal

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

	l, err := local.New(validURL, "")
	assert.Nil(t, err, "Fail to setup a local storage")
	assert.Equal(t, l.String(), validURL)
}