Skip to content

Commit 43bb98e

Browse files
authored
Migrated smoke tests for auto detect blob type (#2729)
1 parent 15f2b10 commit 43bb98e

File tree

3 files changed

+45
-112
lines changed

3 files changed

+45
-112
lines changed
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,45 @@
1+
package e2etest
2+
3+
import (
4+
"github.com/Azure/azure-sdk-for-go/sdk/storage/azblob/blob"
5+
"github.com/Azure/azure-storage-azcopy/v10/common"
6+
)
7+
8+
func init() {
9+
suiteManager.RegisterSuite(&AutoDetectBlobTypeTestSuite{})
10+
}
11+
12+
type AutoDetectBlobTypeTestSuite struct{}
13+
14+
func (s *AutoDetectBlobTypeTestSuite) Scenario_AutoInferDetectBlobTypeVHD(svm *ScenarioVariationManager) {
15+
fileName := "myVHD.vHd" // awkward capitalization to see if AzCopy catches it.
16+
body := NewRandomObjectContentContainer(svm, 4*common.MegaByte)
17+
18+
srcObj := CreateResource[ContainerResourceManager](svm, GetRootResource(svm, ResolveVariation(svm, []common.Location{common.ELocation.Local(), common.ELocation.File(), common.ELocation.Blob()})), ResourceDefinitionContainer{}).
19+
GetObject(svm, fileName, common.EEntityType.File())
20+
srcObj.Create(svm, body, ObjectProperties{})
21+
22+
dstObj := CreateResource[ContainerResourceManager](svm, GetRootResource(svm, common.ELocation.Blob()), ResourceDefinitionContainer{}).
23+
GetObject(svm, fileName, common.EEntityType.File())
24+
25+
// copy vhd file without specifying page blob. Page blob is inferred for VHD, VHDX, and VMDK
26+
RunAzCopy(svm, AzCopyCommand{
27+
Verb: AzCopyVerbCopy,
28+
Targets: []ResourceManager{srcObj, dstObj},
29+
Flags: CopyFlags{
30+
CopySyncCommonFlags: CopySyncCommonFlags{
31+
Recursive: pointerTo(true),
32+
BlockSizeMB: pointerTo(4.0),
33+
},
34+
},
35+
})
36+
37+
ValidateResource[ObjectResourceManager](svm, dstObj, ResourceDefinitionObject{
38+
Body: body,
39+
ObjectProperties: ObjectProperties{
40+
BlobProperties: BlobProperties{
41+
Type: common.Iff(srcObj.Location() == common.ELocation.Blob(), pointerTo(blob.BlobTypeBlockBlob), pointerTo(blob.BlobTypePageBlob)),
42+
},
43+
},
44+
}, true)
45+
}

testSuite/scripts/run.py

-2
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,6 @@
1414
from test_google_cloud_storage_copy import *
1515
from test_blobfs_download_SAS import *
1616
from test_blobfs_upload_SAS import *
17-
from test_autodetect_blob_type import *
1817
from test_file_sync import *
1918
from test_file_copy import *
2019
from test_google_cloud_storage_copy import *
@@ -228,7 +227,6 @@ def main():
228227
BlobFs_Upload_ShareKey_User_Scenarios,
229228
BlobFs_Download_SharedKey_User_Scenarios,
230229
Service_2_Service_Copy_User_Scenario,
231-
Autodetect_Blob_Type_Scenario,
232230
Google_Cloud_Storage_Copy_User_Scenario]
233231
suites_list = []
234232

testSuite/scripts/test_autodetect_blob_type.py

-110
This file was deleted.

0 commit comments

Comments
 (0)