| 1 |
package pathsscip-go gomod github.com/tombuildsstuff/giovanni . `github.com/tombuildsstuff/giovanni/storage/2019-12-12/datalakestore/paths`/ |
| 2 |
|
| 3 |
import ( |
| 4 |
"contextscip-go gomod github.com/golang/go/src go1.13 context/" |
| 5 |
"fmtscip-go gomod github.com/golang/go/src go1.13 fmt/" |
| 6 |
"testingscip-go gomod github.com/golang/go/src go1.13 testing/" |
| 7 |
|
| 8 |
"github.com/Azure/azure-sdk-for-go/profiles/latest/storage/mgmt/storagescip-go gomod github.com/Azure/azure-sdk-for-go v68.0.0 `github.com/Azure/azure-sdk-for-go/profiles/latest/storage/mgmt/storage`/" |
| 9 |
"github.com/tombuildsstuff/giovanni/storage/2019-12-12/datalakestore/filesystemsscip-go gomod github.com/tombuildsstuff/giovanni . `github.com/tombuildsstuff/giovanni/storage/2019-12-12/datalakestore/filesystems`/" |
| 10 |
"github.com/tombuildsstuff/giovanni/testhelpersscip-go gomod github.com/tombuildsstuff/giovanni . `github.com/tombuildsstuff/giovanni/testhelpers`/" |
| 11 |
) |
| 12 |
|
| 13 |
func TestLifecyclescip-go gomod github.com/tombuildsstuff/giovanni . `github.com/tombuildsstuff/giovanni/storage/2019-12-12/datalakestore/paths`/TestLifecycle().(t *testingscip-go gomod github.com/golang/go/src go1.13 testing/.Tscip-go gomod github.com/golang/go/src go1.13 testing/T#) { |
| 14 |
|
| 15 |
const defaultACLString = "user::rwx,group::r-x,other::---" |
| 16 |
|
| 17 |
client, err := testhelpersscip-go gomod github.com/tombuildsstuff/giovanni . `github.com/tombuildsstuff/giovanni/testhelpers`/.Buildscip-go gomod github.com/tombuildsstuff/giovanni . `github.com/tombuildsstuff/giovanni/testhelpers`/Build().(t) |
| 18 |
if err != nil { |
| 19 |
t.Fatalscip-go gomod github.com/golang/go/src go1.13 testing/common#Fatal().(err) |
| 20 |
} |
| 21 |
ctx := contextscip-go gomod github.com/golang/go/src go1.13 context/.TODOscip-go gomod github.com/golang/go/src go1.13 context/TODO().() |
| 22 |
|
| 23 |
resourceGroup := fmtscip-go gomod github.com/golang/go/src go1.13 fmt/.Sprintfscip-go gomod github.com/golang/go/src go1.13 fmt/Sprintf().("acctestrg-%d", testhelpersscip-go gomod github.com/tombuildsstuff/giovanni . `github.com/tombuildsstuff/giovanni/testhelpers`/.RandomIntscip-go gomod github.com/tombuildsstuff/giovanni . `github.com/tombuildsstuff/giovanni/testhelpers`/RandomInt().()) |
| 24 |
accountName := fmtscip-go gomod github.com/golang/go/src go1.13 fmt/.Sprintfscip-go gomod github.com/golang/go/src go1.13 fmt/Sprintf().("acctestsa%s", testhelpersscip-go gomod github.com/tombuildsstuff/giovanni . `github.com/tombuildsstuff/giovanni/testhelpers`/.RandomStringscip-go gomod github.com/tombuildsstuff/giovanni . `github.com/tombuildsstuff/giovanni/testhelpers`/RandomString().()) |
| 25 |
fileSystemName := fmtscip-go gomod github.com/golang/go/src go1.13 fmt/.Sprintfscip-go gomod github.com/golang/go/src go1.13 fmt/Sprintf().("acctestfs-%s", testhelpersscip-go gomod github.com/tombuildsstuff/giovanni . `github.com/tombuildsstuff/giovanni/testhelpers`/.RandomStringscip-go gomod github.com/tombuildsstuff/giovanni . `github.com/tombuildsstuff/giovanni/testhelpers`/RandomString().()) |
| 26 |
path := "test" |
| 27 |
|
| •28 |
if _, err = client.BuildTestResourcesWithHnsscip-go gomod github.com/tombuildsstuff/giovanni . `github.com/tombuildsstuff/giovanni/testhelpers`/Client#BuildTestResourcesWithHns().(ctx, resourceGroup, accountName, storagescip-go gomod github.com/Azure/azure-sdk-for-go v68.0.0 `github.com/Azure/azure-sdk-for-go/profiles/latest/storage/mgmt/storage`/.BlobStoragescip-go gomod github.com/Azure/azure-sdk-for-go v68.0.0 `github.com/Azure/azure-sdk-for-go/profiles/latest/storage/mgmt/storage`/BlobStorage.); err != nil { |
| 29 |
t.Fatalscip-go gomod github.com/golang/go/src go1.13 testing/common#Fatal().(err) |
| 30 |
} |
| 31 |
defer client.DestroyTestResourcesscip-go gomod github.com/tombuildsstuff/giovanni . `github.com/tombuildsstuff/giovanni/testhelpers`/Client#DestroyTestResources().(ctx, resourceGroup, accountName) |
| 32 |
fileSystemsClient := filesystemsscip-go gomod github.com/tombuildsstuff/giovanni . `github.com/tombuildsstuff/giovanni/storage/2019-12-12/datalakestore/filesystems`/.NewWithEnvironmentscip-go gomod github.com/tombuildsstuff/giovanni . `github.com/tombuildsstuff/giovanni/storage/2019-12-12/datalakestore/filesystems`/NewWithEnvironment().(client.Environmentscip-go gomod github.com/tombuildsstuff/giovanni . `github.com/tombuildsstuff/giovanni/testhelpers`/Client#Environment.) |
| 33 |
fileSystemsClient.Clientscip-go gomod github.com/tombuildsstuff/giovanni . `github.com/tombuildsstuff/giovanni/storage/2019-12-12/datalakestore/filesystems`/Client#Client. = client.PrepareWithStorageResourceManagerAuthscip-go gomod github.com/tombuildsstuff/giovanni . `github.com/tombuildsstuff/giovanni/testhelpers`/Client#PrepareWithStorageResourceManagerAuth().(fileSystemsClient.Clientscip-go gomod github.com/tombuildsstuff/giovanni . `github.com/tombuildsstuff/giovanni/storage/2019-12-12/datalakestore/filesystems`/Client#Client.) |
| 34 |
pathsClient := NewWithEnvironmentscip-go gomod github.com/tombuildsstuff/giovanni . `github.com/tombuildsstuff/giovanni/storage/2019-12-12/datalakestore/paths`/NewWithEnvironment().(client.Environmentscip-go gomod github.com/tombuildsstuff/giovanni . `github.com/tombuildsstuff/giovanni/testhelpers`/Client#Environment.) |
| 35 |
pathsClient.Clientscip-go gomod github.com/tombuildsstuff/giovanni . `github.com/tombuildsstuff/giovanni/storage/2019-12-12/datalakestore/paths`/Client#Client. = client.PrepareWithStorageResourceManagerAuthscip-go gomod github.com/tombuildsstuff/giovanni . `github.com/tombuildsstuff/giovanni/testhelpers`/Client#PrepareWithStorageResourceManagerAuth().(fileSystemsClient.Clientscip-go gomod github.com/tombuildsstuff/giovanni . `github.com/tombuildsstuff/giovanni/storage/2019-12-12/datalakestore/filesystems`/Client#Client.) |
| 36 |
|
| 37 |
t.Logfscip-go gomod github.com/golang/go/src go1.13 testing/common#Logf().("[DEBUG] Creating an empty File System..") |
| 38 |
fileSystemInput := filesystemsscip-go gomod github.com/tombuildsstuff/giovanni . `github.com/tombuildsstuff/giovanni/storage/2019-12-12/datalakestore/filesystems`/.CreateInputscip-go gomod github.com/tombuildsstuff/giovanni . `github.com/tombuildsstuff/giovanni/storage/2019-12-12/datalakestore/filesystems`/CreateInput#{} |
| 39 |
if _, err = fileSystemsClient.Createscip-go gomod github.com/tombuildsstuff/giovanni . `github.com/tombuildsstuff/giovanni/storage/2019-12-12/datalakestore/filesystems`/Client#Create().(ctx, accountName, fileSystemName, fileSystemInput); err != nil { |
| 40 |
t.Fatalscip-go gomod github.com/golang/go/src go1.13 testing/common#Fatal().(fmtscip-go gomod github.com/golang/go/src go1.13 fmt/.Errorfscip-go gomod github.com/golang/go/src go1.13 fmt/Errorf().("Error creating: %s", err)) |
| 41 |
} |
| 42 |
|
| 43 |
t.Logfscip-go gomod github.com/golang/go/src go1.13 testing/common#Logf().("[DEBUG] Creating folder 'test' ..") |
| 44 |
input := CreateInputscip-go gomod github.com/tombuildsstuff/giovanni . `github.com/tombuildsstuff/giovanni/storage/2019-12-12/datalakestore/paths`/CreateInput#{ |
| 45 |
Resourcescip-go gomod github.com/tombuildsstuff/giovanni . `github.com/tombuildsstuff/giovanni/storage/2019-12-12/datalakestore/paths`/CreateInput#Resource.: PathResourceDirectoryscip-go gomod github.com/tombuildsstuff/giovanni . `github.com/tombuildsstuff/giovanni/storage/2019-12-12/datalakestore/paths`/PathResourceDirectory., |
| 46 |
} |
| 47 |
if _, err = pathsClient.Createscip-go gomod github.com/tombuildsstuff/giovanni . `github.com/tombuildsstuff/giovanni/storage/2019-12-12/datalakestore/paths`/Client#Create().(ctx, accountName, fileSystemName, path, input); err != nil { |
| 48 |
t.Fatalscip-go gomod github.com/golang/go/src go1.13 testing/common#Fatal().(fmtscip-go gomod github.com/golang/go/src go1.13 fmt/.Errorfscip-go gomod github.com/golang/go/src go1.13 fmt/Errorf().("Error creating: %s", err)) |
| 49 |
} |
| 50 |
|
| 51 |
t.Logfscip-go gomod github.com/golang/go/src go1.13 testing/common#Logf().("[DEBUG] Getting properties for folder 'test' ..") |
| 52 |
props, err := pathsClient.GetPropertiesscip-go gomod github.com/tombuildsstuff/giovanni . `github.com/tombuildsstuff/giovanni/storage/2019-12-12/datalakestore/paths`/Client#GetProperties().(ctx, accountName, fileSystemName, path, GetPropertiesActionGetAccessControlscip-go gomod github.com/tombuildsstuff/giovanni . `github.com/tombuildsstuff/giovanni/storage/2019-12-12/datalakestore/paths`/GetPropertiesActionGetAccessControl.) |
| 53 |
if err != nil { |
| 54 |
t.Fatalscip-go gomod github.com/golang/go/src go1.13 testing/common#Fatal().(fmtscip-go gomod github.com/golang/go/src go1.13 fmt/.Errorfscip-go gomod github.com/golang/go/src go1.13 fmt/Errorf().("Error getting properties: %s", err)) |
| 55 |
} |
| 56 |
t.Logfscip-go gomod github.com/golang/go/src go1.13 testing/common#Logf().("[DEBUG] Props.Owner: %q", props.Ownerscip-go gomod github.com/tombuildsstuff/giovanni . `github.com/tombuildsstuff/giovanni/storage/2019-12-12/datalakestore/paths`/GetPropertiesResponse#Owner.) |
| 57 |
t.Logfscip-go gomod github.com/golang/go/src go1.13 testing/common#Logf().("[DEBUG] Props.Group: %q", props.Groupscip-go gomod github.com/tombuildsstuff/giovanni . `github.com/tombuildsstuff/giovanni/storage/2019-12-12/datalakestore/paths`/GetPropertiesResponse#Group.) |
| 58 |
t.Logfscip-go gomod github.com/golang/go/src go1.13 testing/common#Logf().("[DEBUG] Props.ACL: %q", props.ACLscip-go gomod github.com/tombuildsstuff/giovanni . `github.com/tombuildsstuff/giovanni/storage/2019-12-12/datalakestore/paths`/GetPropertiesResponse#ACL.) |
| 59 |
t.Logfscip-go gomod github.com/golang/go/src go1.13 testing/common#Logf().("[DEBUG] Props.ETag: %q", props.ETagscip-go gomod github.com/tombuildsstuff/giovanni . `github.com/tombuildsstuff/giovanni/storage/2019-12-12/datalakestore/paths`/GetPropertiesResponse#ETag.) |
| 60 |
t.Logfscip-go gomod github.com/golang/go/src go1.13 testing/common#Logf().("[DEBUG] Props.LastModified: %q", props.LastModifiedscip-go gomod github.com/tombuildsstuff/giovanni . `github.com/tombuildsstuff/giovanni/storage/2019-12-12/datalakestore/paths`/GetPropertiesResponse#LastModified.) |
| 61 |
if props.ACLscip-go gomod github.com/tombuildsstuff/giovanni . `github.com/tombuildsstuff/giovanni/storage/2019-12-12/datalakestore/paths`/GetPropertiesResponse#ACL. != defaultACLString { |
| 62 |
t.Fatalscip-go gomod github.com/golang/go/src go1.13 testing/common#Fatal().(fmtscip-go gomod github.com/golang/go/src go1.13 fmt/.Errorfscip-go gomod github.com/golang/go/src go1.13 fmt/Errorf().("Expected Default ACL %q, got %q", defaultACLString, props.ACLscip-go gomod github.com/tombuildsstuff/giovanni . `github.com/tombuildsstuff/giovanni/storage/2019-12-12/datalakestore/paths`/GetPropertiesResponse#ACL.)) |
| 63 |
} |
| 64 |
|
| 65 |
newACL := "user::rwx,group::r-x,other::r-x,default:user::rwx,default:group::r-x,default:other::---" |
| 66 |
accessControlInput := SetAccessControlInputscip-go gomod github.com/tombuildsstuff/giovanni . `github.com/tombuildsstuff/giovanni/storage/2019-12-12/datalakestore/paths`/SetAccessControlInput#{ |
| 67 |
ACLscip-go gomod github.com/tombuildsstuff/giovanni . `github.com/tombuildsstuff/giovanni/storage/2019-12-12/datalakestore/paths`/SetAccessControlInput#ACL.: &newACL, |
| 68 |
} |
| 69 |
t.Logfscip-go gomod github.com/golang/go/src go1.13 testing/common#Logf().("[DEBUG] Setting Access Control for folder 'test' ..") |
| 70 |
if _, err = pathsClient.SetAccessControlscip-go gomod github.com/tombuildsstuff/giovanni . `github.com/tombuildsstuff/giovanni/storage/2019-12-12/datalakestore/paths`/Client#SetAccessControl().(ctx, accountName, fileSystemName, path, accessControlInput); err != nil { |
| 71 |
t.Fatalscip-go gomod github.com/golang/go/src go1.13 testing/common#Fatal().(fmtscip-go gomod github.com/golang/go/src go1.13 fmt/.Errorfscip-go gomod github.com/golang/go/src go1.13 fmt/Errorf().("Error setting Access Control %s", err)) |
| 72 |
} |
| 73 |
|
| 74 |
t.Logfscip-go gomod github.com/golang/go/src go1.13 testing/common#Logf().("[DEBUG] Getting properties for folder 'test' (2) ..") |
| 75 |
props, err = pathsClient.GetPropertiesscip-go gomod github.com/tombuildsstuff/giovanni . `github.com/tombuildsstuff/giovanni/storage/2019-12-12/datalakestore/paths`/Client#GetProperties().(ctx, accountName, fileSystemName, path, GetPropertiesActionGetAccessControlscip-go gomod github.com/tombuildsstuff/giovanni . `github.com/tombuildsstuff/giovanni/storage/2019-12-12/datalakestore/paths`/GetPropertiesActionGetAccessControl.) |
| 76 |
if err != nil { |
| 77 |
t.Fatalscip-go gomod github.com/golang/go/src go1.13 testing/common#Fatal().(fmtscip-go gomod github.com/golang/go/src go1.13 fmt/.Errorfscip-go gomod github.com/golang/go/src go1.13 fmt/Errorf().("Error getting properties (2): %s", err)) |
| 78 |
} |
| 79 |
if props.ACLscip-go gomod github.com/tombuildsstuff/giovanni . `github.com/tombuildsstuff/giovanni/storage/2019-12-12/datalakestore/paths`/GetPropertiesResponse#ACL. != newACL { |
| 80 |
t.Fatalscip-go gomod github.com/golang/go/src go1.13 testing/common#Fatal().(fmtscip-go gomod github.com/golang/go/src go1.13 fmt/.Errorfscip-go gomod github.com/golang/go/src go1.13 fmt/Errorf().("Expected new ACL %q, got %q", newACL, props.ACLscip-go gomod github.com/tombuildsstuff/giovanni . `github.com/tombuildsstuff/giovanni/storage/2019-12-12/datalakestore/paths`/GetPropertiesResponse#ACL.)) |
| 81 |
} |
| 82 |
|
| 83 |
t.Logfscip-go gomod github.com/golang/go/src go1.13 testing/common#Logf().("[DEBUG] Deleting path 'test' ..") |
| 84 |
if _, err = pathsClient.Deletescip-go gomod github.com/tombuildsstuff/giovanni . `github.com/tombuildsstuff/giovanni/storage/2019-12-12/datalakestore/paths`/Client#Delete().(ctx, accountName, fileSystemName, path); err != nil { |
| 85 |
t.Fatalscip-go gomod github.com/golang/go/src go1.13 testing/common#Fatal().(fmtscip-go gomod github.com/golang/go/src go1.13 fmt/.Errorfscip-go gomod github.com/golang/go/src go1.13 fmt/Errorf().("Error deleting path: %s", err)) |
| 86 |
} |
| 87 |
|
| 88 |
t.Logfscip-go gomod github.com/golang/go/src go1.13 testing/common#Logf().("[DEBUG] Getting properties for folder 'test' (3) ..") |
| 89 |
props, err = pathsClient.GetPropertiesscip-go gomod github.com/tombuildsstuff/giovanni . `github.com/tombuildsstuff/giovanni/storage/2019-12-12/datalakestore/paths`/Client#GetProperties().(ctx, accountName, fileSystemName, path, GetPropertiesActionGetAccessControlscip-go gomod github.com/tombuildsstuff/giovanni . `github.com/tombuildsstuff/giovanni/storage/2019-12-12/datalakestore/paths`/GetPropertiesActionGetAccessControl.) |
| 90 |
if err == nil { |
| 91 |
t.Fatalscip-go gomod github.com/golang/go/src go1.13 testing/common#Fatal().(fmtscip-go gomod github.com/golang/go/src go1.13 fmt/.Errorfscip-go gomod github.com/golang/go/src go1.13 fmt/Errorf().("Didn't get error getting properties after deleting path (3)")) |
| 92 |
} |
| 93 |
|
| 94 |
t.Logfscip-go gomod github.com/golang/go/src go1.13 testing/common#Logf().("[DEBUG] Deleting File System..") |
| 95 |
if _, err := fileSystemsClient.Deletescip-go gomod github.com/tombuildsstuff/giovanni . `github.com/tombuildsstuff/giovanni/storage/2019-12-12/datalakestore/filesystems`/Client#Delete().(ctx, accountName, fileSystemName); err != nil { |
| 96 |
t.Fatalfscip-go gomod github.com/golang/go/src go1.13 testing/common#Fatalf().("Error deleting filesystem: %s", err) |
| 97 |
} |
| 98 |
} |