Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Test] Resume_Job Fix E2E Tests #2592

Merged
merged 3 commits into from
Mar 6, 2024
Merged
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
54 changes: 53 additions & 1 deletion e2etest/zt_resume_test.go
Original file line number Diff line number Diff line change
@@ -1,9 +1,12 @@
package e2etest

import (
"os"
"strings"
"testing"

"github.com/Azure/azure-sdk-for-go/sdk/azcore/to"
"github.com/Azure/azure-sdk-for-go/sdk/storage/azblob/container"
"testing"

"github.com/Azure/azure-storage-azcopy/v10/common"
"github.com/google/uuid"
Expand Down Expand Up @@ -125,3 +128,52 @@ func TestResume_PublicSource_ContainerTarget(t *testing.T) {
EAccountType.Standard(), EAccountType.Standard(), "",
)
}

// TestResume_ConsistentLogs_PublicSource_BlobTarget validates log file consistency for a job initially initiated as a copy operation and later resumed.
// During the copy operation, a jobId is created and associated with its log file. If a resume operation follows, the same jobId from the copy is used for the log file, and the resumed logs are appended to it.
// The test ensures that at most two log files are generated: one for scanning logs and one for normal logs.

func TestResume_ConsistentLogs_PublicSource_BlobTarget(t *testing.T) {
RunScenarios(
t,
eOperation.Copy()|eOperation.Resume(),
eTestFromTo.Other(common.EFromTo.BlobBlob(), common.EFromTo.BlobLocal()),
eValidate.Auto(),
anonymousAuthOnly,
anonymousAuthOnly,
params{
recursive: true,
debugSkipFiles: []string{";"}, // skip the only file is ;
},
&hooks{
afterValidation: func(h hookHelper) {
a := h.GetAsserter()
logDir := os.Getenv("AZCOPY_E2E_LOG_OUTPUT")
dir, err := os.Open(logDir)
a.Assert(err, equals(), nil)
defer dir.Close()

entries, err := dir.Readdir(-1)
a.Assert(err, equals(), nil)
var logFiles int
for _, entry := range entries {
if !entry.IsDir() && strings.HasSuffix(entry.Name(), ".log") {
logFiles++
}
}
a.Assert(logFiles <= 2, equals(), true)

},
},
testFiles{
defaultSize: "1K",
sourcePublic: to.Ptr(container.PublicAccessTypeBlob),
objectTarget: objectTarget{objectName: "xyz.txt"},

shouldTransfer: []interface{}{
f("xyz.txt"),
},
},
EAccountType.Standard(), EAccountType.Standard(), "",
)
}
Loading