mirror of
https://github.com/hanzoai/cd.git
synced 2026-10-30 14:56:45 +00:00
Rename test names, comments, fixture data, and mock GitHub/webhook responses that still said Argo/ArgoCD/argocd/argoproj in our own voice, matching the hanzocd-* binary/configmap names and the apps.hanzo.ai CRD/annotation domain already established elsewhere in the fork. Also drop the dated argov1alpha1/argoprojiov1alpha1 import aliases for our own v1alpha1 API package. Restore the CRD groups a prior blind rename had mangled on a vendored third-party Argo Workflows example manifest back to the real argoproj.io, and fix several places where an earlier half-finished rename had gone silently wrong instead of just being cosmetic: stale CD_BINARY_NAME values and a stale --argocd-repo-server flag no longer recognized by the binary, cert filenames and an ssh_known_hosts alias that didn't match what's actually on disk, a namespace and a kustomize image substitution that were silent no-ops, and a test assertion regex that could never match its own fixture. External lookup keys we don't control are left byte-exact: quay.io/argoprojlabs images, the docker.io/argoproj CI builder image, live argoproj/argo-workflows release URLs, the generated ArgoprojV1alpha1() clientset method, and the Makefile-coupled /tmp/argo-e2e and GOPATH mount conventions.
58 lines
2.2 KiB
Go
58 lines
2.2 KiB
Go
package e2e
|
|
|
|
import (
|
|
"testing"
|
|
|
|
. "github.com/hanzoai/cd/pkg/apis/application/v1alpha1"
|
|
. "github.com/hanzoai/cd/test/e2e/fixture/app"
|
|
)
|
|
|
|
func TestAppSyncWrongVersion(t *testing.T) {
|
|
// Make sure the error messages are good when there are group or version mismatches between CRDs and resources.
|
|
ctx := Given(t)
|
|
ctx.
|
|
Path("crd-version-differences").
|
|
When().
|
|
CreateApp().
|
|
// Install CRD and one instance of it on v1alpha1
|
|
AppSet("--directory-include", "crd-v1alpha1.yaml").
|
|
Sync().
|
|
Then().
|
|
Expect(SyncStatusIs(SyncStatusCodeSynced)).
|
|
When().
|
|
AppSet("--directory-include", "crd-v1alpha2-instance.yaml").
|
|
IgnoreErrors(). // Ignore errors because we are testing the error message.
|
|
Sync().
|
|
Then().
|
|
Expect(SyncStatusIs(SyncStatusCodeOutOfSync)).
|
|
When().
|
|
DoNotIgnoreErrors().
|
|
Get().
|
|
Then().
|
|
// Technically it's a "success" because we're just doing a "get," but the get output contains the error message.
|
|
Expect(SuccessRegex(`The Kubernetes API could not find version "v1alpha2" of apps\.hanzo\.ai/Fake for requested resource [a-z0-9-]+/fake-crd-instance\. Version "v1alpha1" of apps\.hanzo\.ai/Fake is installed on the destination cluster\.`)).
|
|
When().
|
|
AppSet("--directory-include", "crd-wronggroup-instance.yaml", "--directory-exclude", "crd-v1alpha2-instance.yaml").
|
|
IgnoreErrors(). // Ignore errors because we are testing the error message.
|
|
Sync().
|
|
Then().
|
|
Expect(SyncStatusIs(SyncStatusCodeOutOfSync)).
|
|
When().
|
|
DoNotIgnoreErrors().
|
|
Get().
|
|
Then().
|
|
Expect(SuccessRegex(`The Kubernetes API could not find version "v1alpha1" of wrong\.group/Fake for requested resource [a-z0-9-]+/fake-crd-instance-wronggroup\. Version "v1alpha1" of apps\.hanzo\.ai/Fake is installed on the destination cluster\.`)).
|
|
When().
|
|
AppSet("--directory-include", "crd-does-not-exist-instance.yaml", "--directory-exclude", "crd-wronggroup-instance.yaml").
|
|
IgnoreErrors(). // Ignore errors because we are testing the error message.
|
|
Sync().
|
|
Then().
|
|
Expect(SyncStatusIs(SyncStatusCodeOutOfSync)).
|
|
When().
|
|
DoNotIgnoreErrors().
|
|
Get().
|
|
Then().
|
|
// Not the best error message, but good enough.
|
|
Expect(Success(`DoesNotExist.apps.hanzo.ai "" not found`))
|
|
}
|