[Storage] Fix live tests azdatalake (#23660)

* fix first 2 live tests azdatalake

* skip 4 tests which require public access

* fix all remaining live tests which used public access

* recordings

* lint errors
This commit is contained in:
tanyasethi-msft 2024-10-28 12:23:40 +05:30 коммит произвёл GitHub
Родитель ee9358aeac
Коммит 9591fab0ac
Не найден ключ, соответствующий данной подписи
Идентификатор ключа GPG: B5690EEEBB952194
3 изменённых файлов: 18 добавлений и 32 удалений

Просмотреть файл

@ -2,5 +2,5 @@
"AssetsRepo": "Azure/azure-sdk-assets",
"AssetsRepoPrefixPath": "go",
"TagPrefix": "go/storage/azdatalake",
"Tag": "go/storage/azdatalake_b2b684d6a6"
"Tag": "go/storage/azdatalake_4f6d93ffc3"
}

Просмотреть файл

@ -96,14 +96,12 @@ func (s *RecordedTestSuite) TestCreateFilesystem() {
func (s *RecordedTestSuite) TestCreateFilesystemWithOptions() {
_require := require.New(s.T())
testName := s.T().Name()
filesystemName := testcommon.GenerateFileSystemName(testName)
testStr := "hello"
metadata := map[string]*string{"foo": &testStr, "bar": &testStr}
access := filesystem.FileSystem
opts := filesystem.CreateOptions{
Metadata: metadata,
Access: &access,
CPKScopeInfo: &testcommon.TestCPKScopeInfo,
}
fsClient, err := testcommon.GetFileSystemClient(filesystemName, s.T(), testcommon.TestAccountDatalake, nil)
@ -116,14 +114,13 @@ func (s *RecordedTestSuite) TestCreateFilesystemWithOptions() {
props, err := fsClient.GetProperties(context.Background(), nil)
_require.NoError(err)
_require.NotNil(props.Metadata)
_require.Equal(*props.PublicAccess, filesystem.FileSystem)
_require.Equal(props.DefaultEncryptionScope, &testcommon.TestEncryptionScope)
}
func (s *RecordedTestSuite) TestCreateFilesystemWithFileAccess() {
s.T().Skip("This test is not valid because public access is disabled")
_require := require.New(s.T())
testName := s.T().Name()
filesystemName := testcommon.GenerateFileSystemName(testName)
testStr := "hello"
metadata := map[string]*string{"foo": &testStr, "bar": &testStr}
@ -143,17 +140,14 @@ func (s *RecordedTestSuite) TestCreateFilesystemWithFileAccess() {
_require.NotNil(props.Metadata)
_require.Equal(*props.PublicAccess, filesystem.File)
}
func (s *RecordedTestSuite) TestCreateFilesystemEmptyMetadata() {
_require := require.New(s.T())
testName := s.T().Name()
filesystemName := testcommon.GenerateFileSystemName(testName)
metadata := map[string]*string{"foo": nil, "bar": nil}
access := filesystem.FileSystem
opts := filesystem.CreateOptions{
Metadata: metadata,
Access: &access,
}
fsClient, err := testcommon.GetFileSystemClient(filesystemName, s.T(), testcommon.TestAccountDatalake, nil)
_require.NoError(err)
@ -165,7 +159,6 @@ func (s *RecordedTestSuite) TestCreateFilesystemEmptyMetadata() {
props, err := fsClient.GetProperties(context.Background(), nil)
_require.NoError(err)
_require.Nil(props.Metadata)
_require.Equal(*props.PublicAccess, filesystem.FileSystem)
}
@ -263,7 +256,6 @@ func (s *RecordedTestSuite) TestFilesystemGetPropertiesWithLease() {
_, err = fsLeaseClient.ReleaseLease(context.Background(), nil)
_require.NoError(err)
}
func (s *RecordedTestSuite) TestFilesystemGetPropertiesDefaultEncryptionScopeAndOverride() {
_require := require.New(s.T())
testName := s.T().Name()
@ -275,11 +267,9 @@ func (s *RecordedTestSuite) TestFilesystemGetPropertiesDefaultEncryptionScopeAnd
testStr := "hello"
metadata := map[string]*string{"foo": &testStr, "bar": &testStr}
access := filesystem.FileSystem
opts := filesystem.CreateOptions{
Metadata: metadata,
Access: &access,
CPKScopeInfo: &testcommon.TestCPKScopeInfo,
}
_, err = fsClient.Create(context.Background(), &opts)
@ -802,9 +792,9 @@ func (s *RecordedTestSuite) TestFilesystemGetSetPermissionsMultiplePolicies() {
}
func (s *RecordedTestSuite) TestFilesystemGetPermissionsPublicAccessNotNone() {
s.T().Skip("this test is not needed as public access is disabled")
_require := require.New(s.T())
testName := s.T().Name()
filesystemName := testcommon.GenerateFileSystemName(testName)
fsClient, err := testcommon.GetFileSystemClient(filesystemName, s.T(), testcommon.TestAccountDatalake, nil)
_require.NoError(err)
@ -823,9 +813,8 @@ func (s *RecordedTestSuite) TestFilesystemGetPermissionsPublicAccessNotNone() {
_require.Equal(*resp.PublicAccess, filesystem.File)
}
// TODO: TestFilesystemSetPermissionsPublicAccessNone()
func (s *RecordedTestSuite) TestFilesystemSetPermissionsPublicAccessTypeFile() {
s.T().Skip("this test is not needed as public access is disabled")
_require := require.New(s.T())
testName := s.T().Name()
@ -848,6 +837,7 @@ func (s *RecordedTestSuite) TestFilesystemSetPermissionsPublicAccessTypeFile() {
}
func (s *RecordedTestSuite) TestFilesystemSetPermissionsPublicAccessFilesystem() {
s.T().Skip("this test is not needed as public access is disabled")
_require := require.New(s.T())
testName := s.T().Name()
@ -900,11 +890,9 @@ func (s *RecordedTestSuite) TestFilesystemSetPermissionsACLMoreThanFive() {
}
}
access := filesystem.File
setAccessPolicyOptions := filesystem.SetAccessPolicyOptions{
Access: &access,
FileSystemACL: permissions,
}
setAccessPolicyOptions.FileSystemACL = permissions
_, err = fsClient.SetAccessPolicy(context.Background(), &setAccessPolicyOptions)
_require.Error(err)
@ -941,11 +929,10 @@ func (s *RecordedTestSuite) TestFilesystemSetPermissionsDeleteAndModifyACL() {
}
}
access := filesystem.File
setAccessPolicyOptions := filesystem.SetAccessPolicyOptions{
Access: &access,
FileSystemACL: permissions,
}
setAccessPolicyOptions.FileSystemACL = permissions
_, err = fsClient.SetAccessPolicy(context.Background(), &setAccessPolicyOptions)
_require.NoError(err)
@ -957,9 +944,9 @@ func (s *RecordedTestSuite) TestFilesystemSetPermissionsDeleteAndModifyACL() {
newId := "0004"
permissions[0].ID = &newId // Modify the remaining policy which is at index 0 in the new slice
setAccessPolicyOptions1 := filesystem.SetAccessPolicyOptions{
Access: &access,
FileSystemACL: permissions,
}
setAccessPolicyOptions1.FileSystemACL = permissions
_, err = fsClient.SetAccessPolicy(context.Background(), &setAccessPolicyOptions1)
_require.NoError(err)
@ -1000,9 +987,8 @@ func (s *RecordedTestSuite) TestFilesystemSetPermissionsDeleteAllPolicies() {
}
setAccessPolicyOptions := filesystem.SetAccessPolicyOptions{
Access: to.Ptr(filesystem.File),
FileSystemACL: permissions,
}
setAccessPolicyOptions.FileSystemACL = permissions
_, err = fsClient.SetAccessPolicy(context.Background(), &setAccessPolicyOptions)
_require.NoError(err)
@ -1012,9 +998,9 @@ func (s *RecordedTestSuite) TestFilesystemSetPermissionsDeleteAllPolicies() {
_require.EqualValues(resp.SignedIdentifiers, permissions)
setAccessPolicyOptions = filesystem.SetAccessPolicyOptions{
Access: to.Ptr(filesystem.File),
FileSystemACL: []*filesystem.SignedIdentifier{},
}
setAccessPolicyOptions.FileSystemACL = []*filesystem.SignedIdentifier{}
_, err = fsClient.SetAccessPolicy(context.Background(), &setAccessPolicyOptions)
_require.NoError(err)
@ -1055,9 +1041,8 @@ func (s *RecordedTestSuite) TestFilesystemSetPermissionsInvalidPolicyTimes() {
}
setAccessPolicyOptions := filesystem.SetAccessPolicyOptions{
Access: to.Ptr(filesystem.File),
FileSystemACL: permissions,
}
setAccessPolicyOptions.FileSystemACL = permissions
_, err = fsClient.SetAccessPolicy(context.Background(), &setAccessPolicyOptions)
_require.NoError(err)
}
@ -1111,9 +1096,9 @@ func (s *RecordedTestSuite) TestFilesystemSetPermissionsSignedIdentifierTooLong(
}
setAccessPolicyOptions := filesystem.SetAccessPolicyOptions{
Access: to.Ptr(filesystem.File),
FileSystemACL: permissions,
}
setAccessPolicyOptions.FileSystemACL = permissions
_, err = fsClient.SetAccessPolicy(context.Background(), &setAccessPolicyOptions)
_require.Error(err)

Просмотреть файл

@ -14,6 +14,7 @@ import (
// PublicAccessType defines values for AccessType - private (default) or file or filesystem.
type PublicAccessType = filesystem.PublicAccessType
// Not to be used anymore as public access is disabled.
const (
File PublicAccessType = filesystem.File
FileSystem PublicAccessType = filesystem.FileSystem