mirror of
https://github.com/gabrie30/ghorg.git
synced 2026-05-06 04:16:10 +02:00
Create windows_gitlab_integration_tests.bat (#549)
This commit is contained in:
parent
f69a19b94e
commit
cef5d1ed28
8
.github/workflows/go-build-test.yml
vendored
8
.github/workflows/go-build-test.yml
vendored
@ -63,7 +63,11 @@ jobs:
|
||||
env:
|
||||
BITBUCKET_TOKEN: ${{ secrets.GHORG_BITBUCKET_APP_PASSWORD }}
|
||||
BITBUCKET_USERNAME: ${{ secrets.GHORG_BITBUCKET_USERNAME }}
|
||||
- name: Run GitLab Cloud Integration Tests
|
||||
- name: Run GitLab Cloud Integration Tests Linux
|
||||
run: scripts/gitlab_cloud_integration_tests.sh
|
||||
env:
|
||||
GITLAB_TOKEN: ${{ secrets.GHORG_GITLAB_TOKEN }}
|
||||
GITLAB_TOKEN: ${{ secrets.GHORG_GITLAB_TOKEN }}
|
||||
- name: Run GitLab Cloud Integration Tests Windows
|
||||
run: scripts/windows_gitlab_integration_tests.bat
|
||||
env:
|
||||
GITLAB_TOKEN: ${{ secrets.GHORG_GITLAB_TOKEN }}
|
||||
|
||||
155
scripts/windows_gitlab_integration_tests.bat
Normal file
155
scripts/windows_gitlab_integration_tests.bat
Normal file
@ -0,0 +1,155 @@
|
||||
@echo off
|
||||
title Windows GitLab Integration Test
|
||||
echo Starting Windows GitLab Integration Tests
|
||||
|
||||
REM Set GitLab test group (same as Linux version)
|
||||
set GITLAB_GROUP=gitlab-examples
|
||||
set GITLAB_SUB_GROUP=wayne-enterprises
|
||||
|
||||
echo.
|
||||
echo ========================================
|
||||
echo Testing Basic GitLab Clone
|
||||
echo ========================================
|
||||
REM Test basic clone functionality
|
||||
ghorg.exe clone %GITLAB_GROUP% --token=%GITLAB_TOKEN% --scm=gitlab
|
||||
|
||||
IF NOT EXIST "%USERPROFILE%\ghorg\%GITLAB_GROUP%\microservice" (
|
||||
echo FAIL: Basic GitLab clone test failed
|
||||
exit /b 1
|
||||
)
|
||||
echo PASS: Basic GitLab clone test
|
||||
|
||||
REM Clean up for next test
|
||||
rmdir /s /q "%USERPROFILE%\ghorg\%GITLAB_GROUP%" 2>nul
|
||||
|
||||
echo.
|
||||
echo ========================================
|
||||
echo Testing Clone with Output Directory
|
||||
echo ========================================
|
||||
REM Test clone with custom output directory
|
||||
ghorg.exe clone %GITLAB_GROUP% --token=%GITLAB_TOKEN% --scm=gitlab --output-dir=gitlab-examples-output
|
||||
|
||||
IF NOT EXIST "%USERPROFILE%\ghorg\gitlab-examples-output\microservice" (
|
||||
echo FAIL: GitLab clone with output directory test failed
|
||||
exit /b 1
|
||||
)
|
||||
echo PASS: GitLab clone with output directory test
|
||||
|
||||
REM Clean up for next test
|
||||
rmdir /s /q "%USERPROFILE%\ghorg\gitlab-examples-output" 2>nul
|
||||
|
||||
echo.
|
||||
echo ========================================
|
||||
echo Testing Clone with Preserve Directory
|
||||
echo ========================================
|
||||
REM Test clone with directory structure preservation
|
||||
ghorg.exe clone %GITLAB_GROUP% --token=%GITLAB_TOKEN% --scm=gitlab --preserve-dir
|
||||
|
||||
IF NOT EXIST "%USERPROFILE%\ghorg\%GITLAB_GROUP%\%GITLAB_SUB_GROUP%\wayne-industries\microservice" (
|
||||
echo FAIL: GitLab clone with preserve directory test failed
|
||||
exit /b 1
|
||||
)
|
||||
echo PASS: GitLab clone with preserve directory test
|
||||
|
||||
REM Clean up for next test
|
||||
rmdir /s /q "%USERPROFILE%\ghorg\%GITLAB_GROUP%" 2>nul
|
||||
|
||||
echo.
|
||||
echo ========================================
|
||||
echo Testing Clone with Preserve SCM Hostname
|
||||
echo ========================================
|
||||
REM Test clone with SCM hostname preservation
|
||||
ghorg.exe clone %GITLAB_GROUP% --token=%GITLAB_TOKEN% --scm=gitlab --preserve-scm-hostname
|
||||
|
||||
IF NOT EXIST "%USERPROFILE%\ghorg\gitlab.com\%GITLAB_GROUP%\microservice" (
|
||||
echo FAIL: GitLab clone with preserve SCM hostname test failed
|
||||
exit /b 1
|
||||
)
|
||||
echo PASS: GitLab clone with preserve SCM hostname test
|
||||
|
||||
REM Clean up for next test
|
||||
rmdir /s /q "%USERPROFILE%\ghorg\gitlab.com" 2>nul
|
||||
|
||||
echo.
|
||||
echo ========================================
|
||||
echo Testing Prune with Preserve Directory
|
||||
echo ========================================
|
||||
REM This is the main test requested - test prune functionality
|
||||
REM First, do an initial clone with preserve-dir, prune, and prune-no-confirm
|
||||
ghorg.exe clone %GITLAB_GROUP% --token=%GITLAB_TOKEN% --scm=gitlab --preserve-dir --prune --prune-no-confirm
|
||||
|
||||
REM Create a fake git repository that should be pruned in the next run
|
||||
REM Use same approach as Linux test: git init with full path
|
||||
echo Creating fake git repository for prune test...
|
||||
git init "%USERPROFILE%\ghorg\%GITLAB_GROUP%\%GITLAB_SUB_GROUP%\wayne-industries\prunable"
|
||||
IF NOT EXIST "%USERPROFILE%\ghorg\%GITLAB_GROUP%\%GITLAB_SUB_GROUP%\wayne-industries\prunable\.git" (
|
||||
echo ERROR: Failed to create .git directory in fake repository
|
||||
exit /b 1
|
||||
)
|
||||
echo Fake git repository created successfully
|
||||
|
||||
REM Run clone again with prune - this should remove the fake repo we just created
|
||||
echo Running second clone with prune to test prune functionality...
|
||||
ghorg.exe clone %GITLAB_GROUP% --token=%GITLAB_TOKEN% --scm=gitlab --preserve-dir --prune --prune-no-confirm
|
||||
|
||||
echo Checking results...
|
||||
REM Check that legitimate repository still exists
|
||||
IF NOT EXIST "%USERPROFILE%\ghorg\%GITLAB_GROUP%\%GITLAB_SUB_GROUP%\wayne-industries\microservice" (
|
||||
echo FAIL: Prune test failed - legitimate repository was removed
|
||||
echo Expected path: "%USERPROFILE%\ghorg\%GITLAB_GROUP%\%GITLAB_SUB_GROUP%\wayne-industries\microservice"
|
||||
exit /b 1
|
||||
)
|
||||
echo Legitimate repository still exists: OK
|
||||
|
||||
REM Check that fake repository was pruned (removed)
|
||||
IF EXIST "%USERPROFILE%\ghorg\%GITLAB_GROUP%\%GITLAB_SUB_GROUP%\wayne-industries\prunable" (
|
||||
echo FAIL: Prune test failed - fake repository was not removed
|
||||
echo Fake repository still exists at: "%USERPROFILE%\ghorg\%GITLAB_GROUP%\%GITLAB_SUB_GROUP%\wayne-industries\prunable"
|
||||
echo Listing contents of wayne-industries directory:
|
||||
dir "%USERPROFILE%\ghorg\%GITLAB_GROUP%\%GITLAB_SUB_GROUP%\wayne-industries" /b
|
||||
exit /b 1
|
||||
)
|
||||
echo Fake repository was successfully pruned: OK
|
||||
echo PASS: GitLab prune with preserve directory test
|
||||
|
||||
REM Clean up for next test
|
||||
rmdir /s /q "%USERPROFILE%\ghorg\%GITLAB_GROUP%" 2>nul
|
||||
|
||||
echo.
|
||||
echo ========================================
|
||||
echo Testing Subgroup Clone
|
||||
echo ========================================
|
||||
REM Test cloning a GitLab subgroup
|
||||
ghorg.exe clone %GITLAB_GROUP%/%GITLAB_SUB_GROUP% --token=%GITLAB_TOKEN% --scm=gitlab
|
||||
|
||||
IF NOT EXIST "%USERPROFILE%\ghorg\%GITLAB_GROUP%\%GITLAB_SUB_GROUP%\microservice" (
|
||||
echo FAIL: GitLab subgroup clone test failed
|
||||
exit /b 1
|
||||
)
|
||||
echo PASS: GitLab subgroup clone test
|
||||
|
||||
REM Clean up for next test
|
||||
rmdir /s /q "%USERPROFILE%\ghorg\%GITLAB_GROUP%" 2>nul
|
||||
|
||||
echo.
|
||||
echo ========================================
|
||||
echo Testing Subgroup Clone with Preserve Directory
|
||||
echo ========================================
|
||||
REM Test subgroup clone with directory preservation
|
||||
ghorg.exe clone %GITLAB_GROUP%/%GITLAB_SUB_GROUP% --token=%GITLAB_TOKEN% --scm=gitlab --preserve-dir
|
||||
|
||||
IF NOT EXIST "%USERPROFILE%\ghorg\%GITLAB_GROUP%\%GITLAB_SUB_GROUP%\wayne-industries\microservice" (
|
||||
echo FAIL: GitLab subgroup clone with preserve directory test failed
|
||||
exit /b 1
|
||||
)
|
||||
echo PASS: GitLab subgroup clone with preserve directory test
|
||||
|
||||
REM Final cleanup
|
||||
rmdir /s /q "%USERPROFILE%\ghorg\%GITLAB_GROUP%" 2>nul
|
||||
|
||||
echo.
|
||||
echo ========================================
|
||||
echo All GitLab Integration Tests Completed Successfully
|
||||
echo ========================================
|
||||
|
||||
EXIT /B 0
|
||||
Loading…
x
Reference in New Issue
Block a user