Skip to content

Commit 514ef31

Browse files
authored
Merge branch 'main' into gapra/loginLibrary
2 parents 5265917 + e359377 commit 514ef31

File tree

4 files changed

+79
-2
lines changed

4 files changed

+79
-2
lines changed

cmd/copy.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1360,6 +1360,7 @@ func (cca *CookedCopyCmdArgs) ReportProgressOrExit(lcm LifecycleMgr) (totalKnown
13601360

13611361
return common.Iff(timeElapsed != 0, bytesInMb/timeElapsed, 0) * 8
13621362
}
1363+
throughput := computeThroughput()
13631364
builder := func(format OutputFormat) string {
13641365
if format == EOutputFormat.Json() {
13651366
jsonOutput, err := json.Marshal(summary)
@@ -1378,7 +1379,6 @@ func (cca *CookedCopyCmdArgs) ReportProgressOrExit(lcm LifecycleMgr) (totalKnown
13781379
scanningString = ""
13791380
}
13801381

1381-
throughput := computeThroughput()
13821382
throughputString := fmt.Sprintf("2-sec Throughput (Mb/s): %v", jobsAdmin.ToFixed(throughput, 4))
13831383
if throughput == 0 {
13841384
// As there would be case when no bits sent from local, e.g. service side copy, when throughput = 0, hide it.

cmd/jobsResume.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -110,6 +110,7 @@ func (cca *resumeJobController) ReportProgressOrExit(lcm LifecycleMgr) (totalKno
110110

111111
return common.Iff(timeElapsed != 0, bytesInMb/timeElapsed, 0) * 8
112112
}
113+
throughput := computeThroughput()
113114
builder := func(format OutputFormat) string {
114115
if format == EOutputFormat.Json() {
115116
jsonOutput, err := json.Marshal(summary)
@@ -123,7 +124,6 @@ func (cca *resumeJobController) ReportProgressOrExit(lcm LifecycleMgr) (totalKno
123124
scanningString = ""
124125
}
125126

126-
throughput := computeThroughput()
127127
throughputString := fmt.Sprintf("2-sec Throughput (Mb/s): %v", jobsAdmin.ToFixed(throughput, 4))
128128
if throughput == 0 {
129129
// As there would be case when no bits sent from local, e.g. service side copy, when throughput = 0, hide it.

e2etest/newe2e_task_validation.go

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -568,3 +568,29 @@ func ValidateLogFileRetention(a Asserter, logsDir string, expectedLogFileToRetai
568568
}
569569
a.AssertNow("Expected job log files to be retained", Equal{}, cnt, expectedLogFileToRetain)
570570
}
571+
572+
// ValidateThroughputOutput validates that throughput information is displayed in AzCopy output
573+
// This is a regression test for the v10.31.0 bug where throughput was hidden when it equaled 0
574+
func ValidateThroughputOutput(a Asserter, stdout AzCopyStdout) {
575+
if dryrunner, ok := a.(DryrunAsserter); ok && dryrunner.Dryrun() {
576+
return
577+
}
578+
579+
var foundThroughput bool
580+
for _, line := range stdout.RawStdout() {
581+
// Look for throughput display patterns:
582+
// - "2-sec Throughput (Mb/s): X.XXXX" (normal display)
583+
// - "Throughput (Mb/s)" (partial match for any throughput display)
584+
if strings.Contains(line, "Throughput (Mb/s)") {
585+
foundThroughput = true
586+
break
587+
}
588+
}
589+
590+
if !foundThroughput {
591+
fmt.Println("=== AzCopy Output for Throughput Validation ===")
592+
fmt.Println(stdout.String())
593+
fmt.Println("=== End AzCopy Output ===")
594+
a.Error("throughput information not found in azcopy output - this may indicate a regression in throughput display")
595+
}
596+
}

e2etest/zt_newe2e_basic_functionality_test.go

Lines changed: 51 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -850,3 +850,54 @@ func (s *BasicFunctionalitySuite) Scenario_JobResume(svm *ScenarioVariationManag
850850
svm.Assert("resume completed transfers not equal to 1", Equal{}, resumeParsed.FinalStatus.TransfersCompleted, uint32(1))
851851
}
852852
}
853+
854+
func (s *BasicFunctionalitySuite) Scenario_ValidateThroughput(svm *ScenarioVariationManager) {
855+
azCopyVerb := ResolveVariation(svm, []AzCopyVerb{AzCopyVerbCopy, AzCopyVerbSync}) // Calculate verb early to create the destination object early
856+
// Resolve variation early so name makes sense
857+
srcLoc := ResolveVariation(svm, []common.Location{common.ELocation.Local(), common.ELocation.Blob()})
858+
// Scale up from service to object
859+
dstContainer := CreateResource[ContainerResourceManager](svm, GetRootResource(svm, ResolveVariation(svm, []common.Location{common.ELocation.Local(), common.ELocation.Blob()})), ResourceDefinitionContainer{})
860+
861+
// Scale up from service to object
862+
srcDef := ResourceDefinitionContainer{
863+
Objects: ObjectResourceMappingFlat{
864+
"abc": ResourceDefinitionObject{Body: NewRandomObjectContentContainer(SizeFromString("10K"))},
865+
"def": ResourceDefinitionObject{Body: NewRandomObjectContentContainer(SizeFromString("10K"))},
866+
"foobar": ResourceDefinitionObject{Body: NewRandomObjectContentContainer(SizeFromString("10K"))},
867+
},
868+
}
869+
srcContainer := CreateResource[ContainerResourceManager](svm, GetRootResource(svm, srcLoc), srcDef)
870+
871+
// no s2s, no local->local
872+
if srcContainer.Location().IsRemote() == dstContainer.Location().IsRemote() {
873+
svm.InvalidateScenario()
874+
return
875+
}
876+
877+
sasOpts := GenericAccountSignatureValues{}
878+
879+
stdOut, _ := RunAzCopy(
880+
svm,
881+
AzCopyCommand{
882+
Verb: azCopyVerb,
883+
Targets: []ResourceManager{
884+
TryApplySpecificAuthType(srcContainer, EExplicitCredentialType.SASToken(), svm, CreateAzCopyTargetOptions{
885+
SASTokenOptions: sasOpts,
886+
}),
887+
TryApplySpecificAuthType(dstContainer, EExplicitCredentialType.SASToken(), svm, CreateAzCopyTargetOptions{
888+
SASTokenOptions: sasOpts,
889+
}),
890+
},
891+
Flags: CopyFlags{
892+
CopySyncCommonFlags: CopySyncCommonFlags{
893+
Recursive: pointerTo(true),
894+
GlobalFlags: GlobalFlags{
895+
OutputType: pointerTo(cmd.EOutputFormat.Text()),
896+
},
897+
},
898+
},
899+
})
900+
901+
// Validate that throughput is displayed in the output (regression test for v10.31.0 throughput display bug)
902+
ValidateThroughputOutput(svm, stdOut)
903+
}

0 commit comments

Comments
 (0)