mirror of
https://github.com/opencloud-eu/opencloud.git
synced 2025-12-23 22:29:59 -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])
|
_, err := semver.NewVersion(editionParts[1])
|
||||||
return err == nil
|
return err == nil
|
||||||
}) {
|
}) {
|
||||||
Edition = Dev
|
defer func() {
|
||||||
return fmt.Errorf(`unknown edition channel "%s"`, Edition)
|
Edition = Dev
|
||||||
|
}()
|
||||||
|
|
||||||
|
return fmt.Errorf(`unknown edition channel '%s'`, Edition)
|
||||||
}
|
}
|
||||||
|
|
||||||
return nil
|
return nil
|
||||||
|
|||||||
@@ -2,6 +2,7 @@ package version_test
|
|||||||
|
|
||||||
import (
|
import (
|
||||||
"fmt"
|
"fmt"
|
||||||
|
"strings"
|
||||||
"testing"
|
"testing"
|
||||||
|
|
||||||
"github.com/opencloud-eu/opencloud/pkg/version"
|
"github.com/opencloud-eu/opencloud/pkg/version"
|
||||||
@@ -59,6 +60,8 @@ func TestChannel(t *testing.T) {
|
|||||||
fallthrough
|
fallthrough
|
||||||
case test.valid != (err == nil):
|
case test.valid != (err == nil):
|
||||||
t.Fatalf("invalid edition: %s", version.Edition)
|
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