mirror of https://github.com/kubevela/kubevela.git
Chore: update test coverage (#4730)
Signed-off-by: Jianbo Sun <jianbo.sjb@alibaba-inc.com> Signed-off-by: Jianbo Sun <jianbo.sjb@alibaba-inc.com>
This commit is contained in:
parent
682c76b8c0
commit
43131d88f5
|
@ -9,3 +9,4 @@ coverage:
|
|||
ignore:
|
||||
- "**/zz_generated.deepcopy.go"
|
||||
- "references/"
|
||||
- "apis/"
|
||||
|
|
|
@ -0,0 +1,43 @@
|
|||
/*
|
||||
Copyright 2022 The KubeVela Authors.
|
||||
|
||||
Licensed under the Apache License, Version 2.0 (the "License");
|
||||
you may not use this file except in compliance with the License.
|
||||
You may obtain a copy of the License at
|
||||
|
||||
http://www.apache.org/licenses/LICENSE-2.0
|
||||
|
||||
Unless required by applicable law or agreed to in writing, software
|
||||
distributed under the License is distributed on an "AS IS" BASIS,
|
||||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
See the License for the specific language governing permissions and
|
||||
limitations under the License.
|
||||
*/
|
||||
|
||||
package version
|
||||
|
||||
import (
|
||||
"testing"
|
||||
|
||||
"github.com/stretchr/testify/assert"
|
||||
)
|
||||
|
||||
func TestIsOfficialKubeVelaVersion(t *testing.T) {
|
||||
assert.Equal(t, true, IsOfficialKubeVelaVersion("v1.2.3"))
|
||||
assert.Equal(t, true, IsOfficialKubeVelaVersion("1.2.3"))
|
||||
assert.Equal(t, true, IsOfficialKubeVelaVersion("v1.2"))
|
||||
assert.Equal(t, true, IsOfficialKubeVelaVersion("v1.2+myvela"))
|
||||
assert.Equal(t, false, IsOfficialKubeVelaVersion("v1.-"))
|
||||
}
|
||||
|
||||
func TestGetVersion(t *testing.T) {
|
||||
version, err := GetOfficialKubeVelaVersion("v1.2.90")
|
||||
assert.Nil(t, err)
|
||||
assert.Equal(t, "1.2.90", version)
|
||||
version, err = GetOfficialKubeVelaVersion("1.2.90")
|
||||
assert.Nil(t, err)
|
||||
assert.Equal(t, "1.2.90", version)
|
||||
version, err = GetOfficialKubeVelaVersion("v1.2+myvela")
|
||||
assert.Nil(t, err)
|
||||
assert.Equal(t, "1.2.0", version)
|
||||
}
|
Loading…
Reference in New Issue