kubewharf / kubeadmiral

Multi-Cluster Kubernetes Orchestration
https://kubeadmiral.io
Apache License 2.0
802 stars 95 forks source link

fix: In e2e test, fedcorev1a1.PropagationPolicySpec.Placements should be a DesiredPlacement type, not ClusterReference type #327

Closed xiaoloongfang closed 3 months ago

xiaoloongfang commented 3 months ago

In e2e test, fedcorev1a1.PropagationPolicySpec.Placements should be a DesiredPlacement type, not ClusterReference type

WHAT HAPPEND

When I run make e2e to test official given testcase, the following problem arises:

➜  kubeadmiral git:(main) ✗ make e2e                            
ginkgo run -race -tags=e2e  test/e2e -- --kubeconfig=/Users/fangxiaolong/.kube/kubeadmiral/kubeadmiral.config 
Failed to compile e2e:

# github.com/kubewharf/kubeadmiral/test/e2e/framework/policies
framework/policies/propagationpolicy.go:41:20: cannot use []fedcorev1a1.ClusterReference{} (value of type []"github.com/kubewharf/kubeadmiral/pkg/apis/core/v1alpha1".ClusterReference) as []"github.com/kubewharf/kubeadmiral/pkg/apis/core/v1alpha1".DesiredPlacement value in struct literal
framework/policies/propagationpolicy.go:46:59: cannot use fedcorev1a1.ClusterReference{…} (value of type "github.com/kubewharf/kubeadmiral/pkg/apis/core/v1alpha1".ClusterReference) as "github.com/kubewharf/kubeadmiral/pkg/apis/core/v1alpha1".DesiredPlacement value in argument to append

Ginkgo ran 1 suite in 36.335954166s

Test Suite Failed
make: *** [e2e] Error 1

This is obviously a type mismatch problem,it may be fixed by this PR.

In my env, this PR could fix the problem and work:

➜  kubeadmiral git:(main) ✗ EXTRA_GINKGO_FLAGS='' EXTRA_E2E_FLAGS='--cluster-provider kind' make e2e
ginkgo run -race -tags=e2e  test/e2e -- --kubeconfig=/Users/fangxiaolong/.kube/kubeadmiral/kubeadmiral.config --cluster-provider kind
Running Suite: KubeAdmiral E2E Tests - /Users/fangxiaolong/develop/kubeadmiral/test/e2e
=======================================================================================
Random Seed: 1718111501

Will run 3 of 3 specs
•••

Ran 3 of 3 Specs in 124.685 seconds
SUCCESS! -- 3 Passed | 0 Failed | 0 Pending | 0 Skipped
PASS

Ginkgo ran 1 suite in 2m13.69917775s
Test Suite Passed
mrlihanbo commented 3 months ago

@xiaoloongfang Thanks for your commit. Could you please rebase your code as we have merged new codes?

xiaoloongfang commented 3 months ago

@xiaoloongfang Thanks for your commit. Could you please rebase your code as we have merged new codes?

Sure and done~

Bright-Hsu commented 2 months ago

I am a beginner in k8s and I had a similar problem. I would like to ask where you get the configuration file(--kubeconfig=/Users/fangxiaolong/.kube/kubeadmiral/kubeadmiral.config) from. Could you give me a reference?

xiaoloongfang commented 1 month ago

I am a beginner in k8s and I had a similar problem. I would like to ask where you get the configuration file(--kubeconfig=/Users/fangxiaolong/.kube/kubeadmiral/kubeadmiral.config) from. Could you give me a reference?

@Bright-Hsu I use the local-up script to set up my local env. In this case, I can find the config file path here https://github.com/kubewharf/kubeadmiral/blob/7a9636a6532588a7597f5627609920c373dcdf8a/hack/make-rules/local-up.sh#L27