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 enhancements #43

Merged
merged 9 commits into from
Aug 27, 2024
15 changes: 13 additions & 2 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -69,9 +69,20 @@ jobs:
- name: Get a file
working-directory: ${{runner.workspace}}/build
shell: bash
run: curl -v http://localhost:8080/aws-opendata/2024/wod_apb_2024.nc -o wod_apb_2024.nc
run: curl -f http://localhost:8080/aws-opendata/2024/wod_apb_2024.nc -o wod_apb_2024.nc

- name: Fail a file
working-directory: ${{runner.workspace}}/build
shell: bash
run: |
if curl -f http://localhost:8080/aws-opendata/2024/bogus_file_name; then
echo "Error: Command unexpectedly succeeded."
exit 1
else
echo "Command failed as expected."
fi

- name: Get metadata
working-directory: ${{runner.workspace}}/build
shell: bash
run: curl -k -X PROPFIND http://localhost:8080/aws-opendata/2024/wod_apb_2024.nc -d prop_query
run: curl -f -k -X PROPFIND http://localhost:8080/aws-opendata/2024/wod_apb_2024.nc -d prop_query
18 changes: 10 additions & 8 deletions src/S3File.cc
Original file line number Diff line number Diff line change
Expand Up @@ -88,14 +88,6 @@ int S3File::Open(const char *path, int Oflag, mode_t Mode, XrdOucEnv &env) {
}
}

AmazonS3CreateMultipartUpload startUpload(m_ai, m_object, m_log);
if (!startUpload.SendRequest()) {
m_log.Emsg("Open", "S3 multipart request failed");
return -ENOENT;
}
std::string errMsg;
startUpload.Results(uploadId, errMsg);

return 0;
}

Expand Down Expand Up @@ -194,6 +186,16 @@ int S3File::Fstat(struct stat *buff) {
}

ssize_t S3File::Write(const void *buffer, off_t offset, size_t size) {
if (uploadId == "") {
AmazonS3CreateMultipartUpload startUpload(m_ai, m_object, m_log);
if (!startUpload.SendRequest()) {
m_log.Emsg("Open", "S3 multipart request failed");
return -ENOENT;
}
std::string errMsg;
startUpload.Results(uploadId, errMsg);
}

std::string payload((char *)buffer, size);
size_t payload_size = payload.length();
if (payload_size != size) {
Expand Down
Loading