diff --git a/.github/workflows/scheduled_workflow.yml b/.github/workflows/scheduled_workflow.yml index c0ff82a..d862686 100644 --- a/.github/workflows/scheduled_workflow.yml +++ b/.github/workflows/scheduled_workflow.yml @@ -16,8 +16,8 @@ name: Scheduled Workflow on: schedule: - # Runs every day at midnight - - cron: '0 0 * * *' + # Runs every day at midnight and noon (beijing time) + - cron: '0 4,16 * * *' jobs: build: @@ -50,5 +50,5 @@ jobs: echo "TOS_REGION=${{ vars.TOS_REGION }}" >> $GITHUB_ENV echo "TOS_ENDPOINT=${{ vars.TOS_ENDPOINT }}" >> $GITHUB_ENV echo "TOSFS_LOGGING_LEVEL=${{ vars.TOSFS_LOGGING_LEVEL }}" >> $GITHUB_ENV - - name: Run tests - run: make test + - name: Run stability tests + run: make test_stability diff --git a/Makefile b/Makefile index f717c8c..29f96e9 100644 --- a/Makefile +++ b/Makefile @@ -12,7 +12,8 @@ help: ## Show the help. @echo "install: ## Install the project in dev mode." @echo "fmt: ## Format code using black & isort." @echo "lint: ## Run pep8, black, mypy linters." - @echo "test: lint ## Run tests and generate coverage report." + @echo "test: ## Run tests and generate coverage report." + @echo "test_stability: ## Run stability tests." @echo "watch: ## Run tests on every change." @echo "clean: ## Clean unused files." @echo "release: ## Create a new tag for release." @@ -47,7 +48,11 @@ lint: ## Run pep8, black, mypy linters. .PHONY: test test: ## Run tests and generate coverage report. - $(ENV_PREFIX)pytest -vv -s --cov-config .coveragerc --cov=tosfs -l --tb=short --maxfail=1 ${TEST_DIR} + $(ENV_PREFIX)pytest -vv -s --cov-config .coveragerc --cov=tosfs -l --tb=short --maxfail=1 ${TEST_DIR} --ignore=${TEST_DIR}/test_stability.py + +.PHONY: test_stability +test_stability: ## Run stability tests. + $(ENV_PREFIX)pytest -vv -s --cov-config .coveragerc --cov=tosfs -l --tb=short --maxfail=1 ${TEST_DIR}/test_stability.py .PHONY: watch watch: ## Run tests on every change. diff --git a/tosfs/tests/test_stability.py b/tosfs/tests/test_stability.py index 140f196..14f746d 100644 --- a/tosfs/tests/test_stability.py +++ b/tosfs/tests/test_stability.py @@ -25,7 +25,7 @@ def test_write_breakpoint_continuation(tosfs, bucket, temporary_workspace): with tosfs.open(f"{bucket}/{temporary_workspace}/{file_name}", "w") as f: f.write(first_part) # mock a very long block(business processing or network issue) - sleep(60) + sleep(60 * 15) f.write(second_part) assert tosfs.info(f"{bucket}/{temporary_workspace}/{file_name}")["size"] == len( @@ -49,7 +49,7 @@ def test_read_breakpoint_continuation(tosfs, bucket, temporary_workspace): read_first_part = f.read(10 * 1024 * 1024) assert read_first_part == first_part # mock a very long block(business processing or network issue) - sleep(60) + sleep(60 * 15) read_second_part = f.read(10 * 1024 * 1024) assert read_second_part == second_part assert read_first_part + read_second_part == first_part + second_part