-
Notifications
You must be signed in to change notification settings - Fork 229
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Improved some logging messages and --log-level NONE behavior (#2845)
- Loading branch information
1 parent
74ff288
commit 7cecb73
Showing
16 changed files
with
171 additions
and
35 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,92 @@ | ||
// Copyright © Microsoft <[email protected]> | ||
// | ||
// Permission is hereby granted, free of charge, to any person obtaining a copy | ||
// of this software and associated documentation files (the "Software"), to deal | ||
// in the Software without restriction, including without limitation the rights | ||
// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell | ||
// copies of the Software, and to permit persons to whom the Software is | ||
// furnished to do so, subject to the following conditions: | ||
// | ||
// The above copyright notice and this permission notice shall be included in | ||
// all copies or substantial portions of the Software. | ||
// | ||
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR | ||
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, | ||
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE | ||
// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER | ||
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, | ||
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN | ||
// THE SOFTWARE. | ||
|
||
package e2etest | ||
|
||
import ( | ||
"time" | ||
|
||
"github.com/Azure/azure-storage-azcopy/v10/common" | ||
) | ||
|
||
func init() { | ||
suiteManager.RegisterSuite(&FlagsFunctionalitySuite{}) | ||
} | ||
|
||
type FlagsFunctionalitySuite struct{} | ||
|
||
// @brief This test verifies that when the --log-level is set to NONE, | ||
// AzCopy does not display the "Log files located" message on the console. | ||
func (s *FlagsFunctionalitySuite) Scenario_LogLevelNone(svm *ScenarioVariationManager) { | ||
azCopyVerb := ResolveVariation(svm, []AzCopyVerb{AzCopyVerbCopy, AzCopyVerbSync}) // Calculate verb early to create the destination object early | ||
// Scale up from service to object | ||
dstObj := CreateResource[ContainerResourceManager](svm, GetRootResource(svm, ResolveVariation(svm, []common.Location{common.ELocation.Local(), common.ELocation.Blob(), common.ELocation.File(), common.ELocation.BlobFS()})), ResourceDefinitionContainer{}).GetObject(svm, "test", common.EEntityType.File()) | ||
|
||
// The object must exist already if we're syncing. | ||
if azCopyVerb == AzCopyVerbSync { | ||
dstObj.Create(svm, NewZeroObjectContentContainer(0), ObjectProperties{}) | ||
|
||
if !svm.Dryrun() { | ||
// Make sure the LMT is in the past | ||
time.Sleep(time.Second * 10) | ||
} | ||
} | ||
|
||
body := NewRandomObjectContentContainer(SizeFromString("10K")) | ||
// Scale up from service to object | ||
srcObj := CreateResource[ObjectResourceManager](svm, GetRootResource(svm, ResolveVariation(svm, []common.Location{ /*common.ELocation.Local(), */ common.ELocation.Blob() /*, common.ELocation.File(), common.ELocation.BlobFS()*/})), ResourceDefinitionObject{ | ||
ObjectName: pointerTo("test"), | ||
Body: body, | ||
}) | ||
|
||
// no local->local | ||
if srcObj.Location().IsLocal() && dstObj.Location().IsLocal() { | ||
svm.InvalidateScenario() | ||
return | ||
} | ||
|
||
sasOpts := GenericAccountSignatureValues{} | ||
logLevel := common.LogLevel.None(common.LogNone) | ||
outputType := common.EOutputFormat.Text() | ||
|
||
stdOut, _ := RunAzCopy( | ||
svm, | ||
AzCopyCommand{ | ||
Verb: azCopyVerb, | ||
Targets: []ResourceManager{ | ||
TryApplySpecificAuthType(srcObj, EExplicitCredentialType.SASToken(), svm, CreateAzCopyTargetOptions{ | ||
SASTokenOptions: sasOpts, | ||
}), | ||
TryApplySpecificAuthType(dstObj, EExplicitCredentialType.SASToken(), svm, CreateAzCopyTargetOptions{ | ||
SASTokenOptions: sasOpts, | ||
}), | ||
}, | ||
Flags: CopyFlags{ | ||
CopySyncCommonFlags: CopySyncCommonFlags{ | ||
Recursive: pointerTo(true), | ||
GlobalFlags: GlobalFlags{ | ||
LogLevel: &logLevel, | ||
OutputType: &outputType, | ||
}, | ||
}, | ||
}, | ||
}) | ||
ValidateMessageOutput(svm, stdOut, "Log file is located at", false) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.