Skip to content

Commit

Permalink
add UpRemove test
Browse files Browse the repository at this point in the history
  • Loading branch information
iychoi committed Jan 7, 2025
1 parent 19edd36 commit 1394c9d
Show file tree
Hide file tree
Showing 2 changed files with 49 additions and 1 deletion.
2 changes: 1 addition & 1 deletion test/server/config.inc
Original file line number Diff line number Diff line change
Expand Up @@ -8,4 +8,4 @@ export IRODS_LAST_EPHEMERAL_PORT=20199

export DBMS_CONF_HOST="$ENV_NAME"_dbms_1."$DOMAIN"
export IRODS_CONF_HOST="$ENV_NAME"_irods_1."$DOMAIN"
export IRODS_VER="4.2.8"
export IRODS_VER="4.2.11"
48 changes: 48 additions & 0 deletions test/testcases/fs_io_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ func TestFSIO(t *testing.T) {
makeHomeDir(t, fsIOTestID)

t.Run("test UpDownMBFiles", testUpDownMBFiles)
t.Run("test UpRemoveMBFiles", testUpRemoveMBFiles)
t.Run("test UpDownMBFilesParallel", testUpDownMBFilesParallel)
t.Run("test UpDownMBFilesParallelRedirectToResource", testUpDownMBFilesParallelRedirectToResource)
}
Expand Down Expand Up @@ -75,6 +76,53 @@ func testUpDownMBFiles(t *testing.T) {
failError(t, err)
}

func testUpRemoveMBFiles(t *testing.T) {
account := GetTestAccount()

account.ClientServerNegotiation = false

fsConfig := GetTestFileSystemConfig()

filesystem, err := fs.NewFileSystem(account, fsConfig)
failError(t, err)
defer filesystem.Release()

homedir := getHomeDir(fsIOTestID)
testDirPath := path.Join(homedir, "test_dir")

fileSize := int64(100 * 1024 * 1024) // 100MB
localPath, err := createLocalTestFile("test_file_", fileSize)
failError(t, err)

iRODSPath := fmt.Sprintf("%s/%s", testDirPath, path.Base(localPath))

// core
for i := 0; i < 100; i++ {
t.Logf("iteration %d, making dir", i)
err = filesystem.MakeDir(testDirPath, true)
failError(t, err)

t.Logf("iteration %d, uploading file", i)
_, err = filesystem.UploadFile(localPath, iRODSPath, "", false, true, true, nil)
failError(t, err)

t.Logf("iteration %d, stating file", i)
fileStat, err := filesystem.Stat(iRODSPath)
failError(t, err)

if fileStat.Size != fileSize {
failError(t, fmt.Errorf("wrong size"))
}

t.Logf("iteration %d, removing dir", i)
err = filesystem.RemoveDir(testDirPath, true, true)
failError(t, err)
}

err = os.Remove(localPath)
failError(t, err)
}

func testUpDownMBFilesParallel(t *testing.T) {
account := GetTestAccount()

Expand Down

0 comments on commit 1394c9d

Please sign in to comment.