-
Notifications
You must be signed in to change notification settings - Fork 26
Open
Labels
Description
The logic in the following code will always result in a failure when executing tests on a tagged commit since it checks that the reported version by the wins binary is equivalent to the commit hash.
wins/tests/integration/application_test.ps1
Lines 59 to 63 in 070f014
$version = Execute-Binary -FilePath "git.exe" -ArgumentList @("rev-parse", "--short", "HEAD") -PassThru | |
if (-not $version.Ok) { | |
Log-Error $version.Output | |
$false | Should -Be $true | |
} |
This results in the following error on jobs:
Starting discovery in 1 files.
Discovery found 3 tests in 1.02s.
Running tests.
Error: [-] application.upgrade.watching 39.52s (39.52s|3ms)
Message
Tests completed in 45.69s
Tests Passed: 2, Failed: 1, Skipped: 0 NotRun: 0
FATA Failed to pass D:\a\wins\wins\tests\integration\application_test.ps1
Error: running "powershell.exe tests\integration\integration_suite_test.ps1" failed with exit code 1
Error: Process completed with exit code 1.
Failed Job: https://github.com/rancher/wins/actions/runs/8851112339/job/24306934261
The fix for this issue should be to change the logic here to match the logic within the magefile:
Lines 32 to 70 in 070f014
func Version() error { | |
c, err := magetools.GetCommit() | |
if err != nil { | |
return err | |
} | |
commit = c | |
dt := os.Getenv("DRONE_TAG") | |
isClean, err := magetools.IsGitClean() | |
if err != nil { | |
return err | |
} | |
if dt != "" && isClean { | |
version = dt | |
return nil | |
} | |
tag, err := magetools.GetLatestTag() | |
if err != nil { | |
return err | |
} | |
if tag != "" && isClean { | |
version = tag | |
return nil | |
} | |
version = commit | |
if !isClean { | |
version = commit + "-dirty" | |
log.Printf("[Version] dirty version encountered: %s \n", version) | |
} | |
// check if this is a release version and fail if the version contains `dirty` | |
if strings.Contains(version, "dirty") && os.Getenv("DRONE_TAG") != "" || tag != "" { | |
return fmt.Errorf("[Version] releases require a non-dirty tag: %s", version) | |
} | |
log.Printf("[Version] version: %s \n", version) | |
return nil | |
} |