Skip to content

Commit

Permalink
Refactor scheduled workflow for stability (#134)
Browse files Browse the repository at this point in the history
* Update scheduled workflow cron

* Refactor scheduled workflow for stability
  • Loading branch information
yanghua authored Sep 25, 2024
1 parent 8646b1f commit 1a76263
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 8 deletions.
8 changes: 4 additions & 4 deletions .github/workflows/scheduled_workflow.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down Expand Up @@ -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
9 changes: 7 additions & 2 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -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."
Expand Down Expand Up @@ -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.
Expand Down
4 changes: 2 additions & 2 deletions tosfs/tests/test_stability.py
Original file line number Diff line number Diff line change
Expand Up @@ -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(
Expand All @@ -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

0 comments on commit 1a76263

Please sign in to comment.