mirror of
https://github.com/opencloud-eu/opencloud.git
synced 2025-12-23 14:20:13 -05:00
fix: propagate the current edition channel in the edition validation error
This commit is contained in:
@@ -79,8 +79,11 @@ func initEdition() error {
|
||||
_, err := semver.NewVersion(editionParts[1])
|
||||
return err == nil
|
||||
}) {
|
||||
Edition = Dev
|
||||
return fmt.Errorf(`unknown edition channel "%s"`, Edition)
|
||||
defer func() {
|
||||
Edition = Dev
|
||||
}()
|
||||
|
||||
return fmt.Errorf(`unknown edition channel '%s'`, Edition)
|
||||
}
|
||||
|
||||
return nil
|
||||
|
||||
@@ -2,6 +2,7 @@ package version_test
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
"strings"
|
||||
"testing"
|
||||
|
||||
"github.com/opencloud-eu/opencloud/pkg/version"
|
||||
@@ -59,6 +60,8 @@ func TestChannel(t *testing.T) {
|
||||
fallthrough
|
||||
case test.valid != (err == nil):
|
||||
t.Fatalf("invalid edition: %s", version.Edition)
|
||||
case !test.valid && !strings.Contains(err.Error(), "'"+test.got+"'"):
|
||||
t.Fatalf("no mention of invalid edition '%s' in error: %s", test.got, err.Error())
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user