mirror of
https://github.com/kubevela/kubevela.git
synced 2026-08-18 03:56:36 +00:00
fix e2e test
This commit is contained in:
@@ -34,25 +34,6 @@ jobs:
|
||||
with:
|
||||
version: "v0.7.0"
|
||||
|
||||
# TODO(zzxwill) This step and the follow one need to be removed after rudr admin:init is ready
|
||||
- name: Install OAM runtime and prepare WorkloadDefinitions/TraitDefinitions
|
||||
run: |
|
||||
sudo apt-get install -y apt-transport-https gnupg2
|
||||
curl -s https://packages.cloud.google.com/apt/doc/apt-key.gpg | sudo apt-key add -
|
||||
echo "deb https://apt.kubernetes.io/ kubernetes-xenial main" | sudo tee -a /etc/apt/sources.list.d/kubernetes.list
|
||||
sudo apt-get install -y kubectl
|
||||
|
||||
curl https://helm.baltorepo.com/organization/signing.asc | sudo apt-key add -
|
||||
sudo apt-get install apt-transport-https --yes
|
||||
echo "deb https://baltocdn.com/helm/stable/debian/ all main" | sudo tee /etc/apt/sources.list.d/helm-stable-debian.list
|
||||
sudo apt-get update
|
||||
sudo apt-get install helm
|
||||
kubectl create namespace oam-system
|
||||
helm repo add crossplane-master https://charts.crossplane.io/master/
|
||||
helm install oam --namespace oam-system crossplane-master/oam-kubernetes-runtime --devel
|
||||
|
||||
kubectl apply -R -f config/samples
|
||||
|
||||
- name: Run e2e tests
|
||||
run: |
|
||||
make e2e-setup
|
||||
|
||||
+1
-1
@@ -162,7 +162,7 @@ func PrintHelpByTag(cmd *cobra.Command, all []*cobra.Command, tag string) {
|
||||
if len(table.Rows) > 0 {
|
||||
cmd.Println()
|
||||
}
|
||||
cmd.Println(" Want more? <use 'vela refresh' to sync from cluster or install by `vela cap` >")
|
||||
cmd.Println(" Want more? < install more capabilities by `vela cap` >")
|
||||
}
|
||||
cmd.Println()
|
||||
}
|
||||
|
||||
+1
-2
@@ -45,6 +45,5 @@ func Exec(cli string) (string, error) {
|
||||
func BeforeSuit() {
|
||||
_, err := GetCliBinary()
|
||||
gomega.Expect(err).NotTo(gomega.HaveOccurred())
|
||||
//Exec("vela system:init")
|
||||
Exec("vela refresh")
|
||||
Exec("vela system:init")
|
||||
}
|
||||
|
||||
@@ -25,7 +25,7 @@ var (
|
||||
RefreshContext = func(context string) bool {
|
||||
return ginkgo.Context(context, func() {
|
||||
ginkgo.It("Sync commands from your Kubernetes cluster and locally cached them", func() {
|
||||
output, err := Exec("vela refresh")
|
||||
output, err := Exec("vela system:update")
|
||||
gomega.Expect(err).NotTo(gomega.HaveOccurred())
|
||||
gomega.Expect(output).To(gomega.ContainSubstring("syncing workload definitions from cluster..."))
|
||||
gomega.Expect(output).To(gomega.ContainSubstring("successfully synced"))
|
||||
|
||||
@@ -0,0 +1,26 @@
|
||||
package builtin
|
||||
|
||||
import (
|
||||
"testing"
|
||||
|
||||
"k8s.io/apimachinery/pkg/apis/meta/v1/unstructured"
|
||||
|
||||
"github.com/ghodss/yaml"
|
||||
"github.com/stretchr/testify/assert"
|
||||
|
||||
"github.com/cloud-native-application/rudrx/pkg/builtin/traitdefinition"
|
||||
"github.com/cloud-native-application/rudrx/pkg/builtin/workloaddefinition"
|
||||
)
|
||||
|
||||
func TestValidYaml(t *testing.T) {
|
||||
cases := map[string]string{
|
||||
"scale": traitdefinition.ManualScaler,
|
||||
"rollout": traitdefinition.SimpleRollout,
|
||||
"containerized": workloaddefinition.ContainerizedWorkload,
|
||||
"deployment": workloaddefinition.Deployment,
|
||||
}
|
||||
for name, val := range cases {
|
||||
data := unstructured.Unstructured{}
|
||||
assert.NoError(t, yaml.Unmarshal([]byte(val), &data), name)
|
||||
}
|
||||
}
|
||||
@@ -2,29 +2,29 @@ package traitdefinition
|
||||
|
||||
var ManualScaler = `apiVersion: core.oam.dev/v1alpha2
|
||||
kind: TraitDefinition
|
||||
metadata:
|
||||
metadata:
|
||||
annotations:
|
||||
oam.appengine.info/apiVersion: core.oam.dev/v1alpha2
|
||||
oam.appengine.info/kind: ManualScalerTrait
|
||||
name: manualscalertraits.core.oam.dev
|
||||
annotations:
|
||||
oam.appengine.info/apiVersion: "core.oam.dev/v1alpha2"
|
||||
oam.appengine.info/kind: "ManualScalerTrait"
|
||||
spec:
|
||||
appliesToWorkloads:
|
||||
spec:
|
||||
appliesToWorkloads:
|
||||
- core.oam.dev/v1alpha2.ContainerizedWorkload
|
||||
- apps/v1.Deployment
|
||||
workloadRefPath: spec.workloadRef
|
||||
definitionRef:
|
||||
- apps/v1.Deployment
|
||||
definitionRef:
|
||||
name: manualscalertraits.core.oam.dev
|
||||
extension:
|
||||
template: |
|
||||
#Template: {
|
||||
apiVersion: "core.oam.dev/v1alpha2"
|
||||
kind: "ManualScalerTrait"
|
||||
spec: {
|
||||
replicaCount: scale.replica
|
||||
}
|
||||
}
|
||||
scale: {
|
||||
//+short=r
|
||||
replica: *2 | int
|
||||
}
|
||||
extension:
|
||||
template: |-
|
||||
#Template: {
|
||||
apiVersion: "core.oam.dev/v1alpha2"
|
||||
kind: "ManualScalerTrait"
|
||||
spec: {
|
||||
replicaCount: scale.replica
|
||||
}
|
||||
}
|
||||
scale: {
|
||||
//+short=r
|
||||
replica: *2 | int
|
||||
}
|
||||
workloadRefPath: spec.workloadRef
|
||||
`
|
||||
|
||||
@@ -413,6 +413,7 @@ func GenNativeResourceDefinition(c client.Client) error {
|
||||
for name, manifest := range traitResource {
|
||||
traitDefinition, err := NewTraitDefinition(manifest)
|
||||
if err != nil {
|
||||
fmt.Printf("creating local definition %s err %v", name, err)
|
||||
continue
|
||||
}
|
||||
err = c.Get(context.Background(), client.ObjectKey{Name: name}, &traitDefinition)
|
||||
|
||||
Reference in New Issue
Block a user