Skip to content

How to test automation changes before committing to master

Allan Roger Reid edited this page Dec 3, 2024 · 1 revision

1.- Change the automation development code

Checkout automation-demo branch

Add a new example line to run.sh

echo -n "This is a test" >>"${LOG_FILE}"

Push example changes

git add run.sh
git commit -m "Initial commit"
git push --set-upstream origin automation-demo
[automation-demo c111c5c] Initial commit
 1 file changed, 1 insertion(+)

View changes in git log

commit c111c5c15e93d0bcc6a55e0647fe032b073b650e (HEAD -> automation-demo, origin/automation-demo)
Author: Allan Reid <allanrogerreid@gmail.com>
Date:   Tue Dec 3 13:08:38 2024 -0800

    Initial commit

2.- Change the aistor-operator development code

Checkout aistor-operator-demo branch

git checkout -b aistor-operator-demo
Switched to a new branch 'aistor-operator-demo'

Minimize the branch for testing

e.g. in .github/workflows/reusable-minio-feature-tests.yml leave only job test-resiliency

Create a temporary branch on main repo to utilize the self-hosted runner infrastructure.

git remote set-url origin https://allanrogerr:<pat>@github.com/miniohq/aistor-operator.git
git add .github/workflows/reusable-minio-feature-tests.yml
git commit -m "Initial commit"
git push --set-upstream origin aistor-operator-demo

Launch the test to create a baseline

gh workflow run .github/workflows/reusable-minio-feature-tests.yml --ref aistor-operator-demo

Observe the original automation commit is pulled in the gh workflow

2024-12-03T21:14:39.2717224Z Entering 'testing/automation'
2024-12-03T21:14:39.2770976Z HEAD is now at b821aa3 Make sure log file parent directory exists (#162)
2024-12-03T21:14:39.2801146Z Entering 'testing/minio-iam-testing'
2024-12-03T21:14:39.2828035Z HEAD is now at dc8b185 fix: the service ports and use standard ports

3.- Run a test on automation development branch

Point to development automation submodule in .gitmodules

[submodule "automation"]
  path = testing/automation
  url = https://github.com/allanrogerr/automation
  branch = automation-demo

Use above automation development changes

git fetch
cd testing/automation
git checkout -b automation-demo
git checkout c111c5c15e93d0bcc6a55e0647fe032b073b650e
git log | head -5
Previous HEAD position was b821aa3 Make sure log file parent directory exists (#162)
Switched to a new branch 'automation-demo'
Note: switching to 'c111c5c15e93d0bcc6a55e0647fe032b073b650e'.

commit c111c5c15e93d0bcc6a55e0647fe032b073b650e
Author: Allan Reid <allanrogerreid@gmail.com>
Date:   Tue Dec 3 13:08:38 2024 -0800

    Initial commit

Push changes

cd ../..
git status testing/automation
git add testing/automation
git commit -m "New automation development"
git push

Launch the test to run with automation development changes

gh workflow run .github/workflows/reusable-minio-feature-tests.yml --ref aistor-operator-demo

Observe the new automation development commit is pulled in the gh workflow

2024-12-03T21:14:39.2717224Z Entering 'testing/automation'
2024-12-03T21:14:39.2770976Z HEAD is now at b821aa3 Make sure log file parent directory exists (#162)
2024-12-03T21:14:39.2801146Z Entering 'testing/minio-iam-testing'
2024-12-03T21:14:39.2828035Z HEAD is now at dc8b185 fix: the service ports and use standard ports

Observe the new code being invoked

ubuntu@miniohq-runner-k1-27:/tmp/aistor-operator/logs$ This is a testRunning with Test Name: resiliency-tests/resiliency-test.sh Test Type: resiliency MinIO Version: latest MinIO Client Version: latest MINIO_ENTERPRISE_TEST_WITH_HOTFIX_VERSION:  MC_ENTERPRISE_TEST_WITH_HOTFIX_VERSION:  TEST_WITH_LOCAL_BUILDS: 

4.- Cleanup

  • Merge automation branch into master
  • Revert the changes to the .gitmodules file in aistor-operator, for example
[submodule "automation"]
  path = testing/automation
  url = https://github.com/miniohq/automation
  • Revert any changes to git remote set-url origin ...
  • Revert any unnecessary changes to the aistor-operator branch, for example.
Clone this wiki locally