diff --git a/.github/workflows/fs_write_full_disk.yml b/.github/workflows/fs_write_full_disk.yml new file mode 100644 index 00000000000..862657d497d --- /dev/null +++ b/.github/workflows/fs_write_full_disk.yml @@ -0,0 +1,52 @@ +# Licensed to the Apache Software Foundation (ASF) under one +# or more contributor license agreements. See the NOTICE file +# distributed with this work for additional information +# regarding copyright ownership. The ASF licenses this file +# to you under the Apache License, Version 2.0 (the +# "License"); you may not use this file except in compliance +# with the License. You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, +# software distributed under the License is distributed on an +# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +# KIND, either express or implied. See the License for the +# specific language governing permissions and limitations +# under the License. + +name: Fs write full disk + +on: + push: + branches: + - main + +jobs: + test: + runs-on: ubuntu-latest + + steps: + - name: Checkout code + uses: actions/checkout@v2 + + - name: Create disk image + run: | + fallocate -l 512K disk.img + mkfs disk.img + + - name: Mount disk image + run: | + mkdir ./td + sudo mount -o loop disk.img ./td + + - name: Set permissions + run: chmod a+wr ./td + + # Add more steps for testing as needed + + - name: Clean up + run: | + sudo umount ./td + rm -rf ./td + rm disk.img diff --git a/core/tests/behavior/file_write_full_disk.rs b/core/tests/behavior/file_write_full_disk.rs new file mode 100644 index 00000000000..0198af25a8e --- /dev/null +++ b/core/tests/behavior/file_write_full_disk.rs @@ -0,0 +1,25 @@ +// Licensed to the Apache Software Foundation (ASF) under one +// or more contributor license agreements. See the NOTICE file +// distributed with this work for additional information +// regarding copyright ownership. The ASF licenses this file +// to you under the Apache License, Version 2.0 (the +// "License"); you may not use this file except in compliance +// with the License. You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, +// software distributed under the License is distributed on an +// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +// KIND, either express or implied. See the License for the +// specific language governing permissions and limitations +// under the License. + +#[cfg(test)] +mod tests { + #[tokio::test] + async fn test_file_write_on_full_disk() { + let data = [96u8; 1024 * 512]; // The writable was smaller than 512KB + op.write("/test", data.to_vec()).await.unwrap(); + } +} diff --git a/core/tests/behavior/main.rs b/core/tests/behavior/main.rs index bc7678407a4..1bc99da0ba4 100644 --- a/core/tests/behavior/main.rs +++ b/core/tests/behavior/main.rs @@ -47,6 +47,7 @@ mod blocking_list; mod blocking_read_only; mod blocking_rename; mod blocking_write; +mod file_write_full_disk; use blocking_copy::behavior_blocking_copy_tests; use blocking_list::behavior_blocking_list_tests;