예제 #1
0
// This test is the same as TestAzureClient with the addition of using the
// lease_id config option
func TestAzureClientLease(t *testing.T) {
	leaseID := uuid.NewV4().String()
	config := getAzureConfig(t)
	config["lease_id"] = leaseID

	setup(t, config)
	defer teardown(t, config)

	client, err := azureFactory(config)
	if err != nil {
		t.Fatalf("Error for valid config: %v", err)
	}
	azureClient := client.(*AzureClient)

	// put empty blob so we can acquire lease against it
	err = azureClient.blobClient.CreateBlockBlob(azureClient.containerName, azureClient.keyName)
	if err != nil {
		t.Fatalf("Error creating blob for leasing: %v", err)
	}

	_, err = azureClient.blobClient.AcquireLease(azureClient.containerName, azureClient.keyName, -1, leaseID)
	if err != nil {
		t.Fatalf("Error acquiring lease: %v", err)
	}

	// no need to release lease as blob is deleted in testing
	testClient(t, client)
}
예제 #2
0
파일: qiniu.go 프로젝트: wxaxiaoyao/linux
func GetToken() (string, string) {
	key := uuid.NewV4().String()
	putPolicy := rs.PutPolicy{
		Scope:        g_bucket_name + ":" + key,
		CallbackUrl:  CALLBACK_URL,
		CallbackBody: g_callback_body,
		ReturnUrl:    g_return_url,
		ReturnBody:   g_return_body,
	}

	return putPolicy.Token(nil), key
}
예제 #3
0
파일: uuid.go 프로젝트: sunyuantao/windows
func GetUid() string {
	return uuid.NewV4().String()
}