INNER CODE UNIT · Go

MockArgoServerWithAppSets

darksworm/argonaut · e2e/appset_test.go:14

func MockArgoServerWithAppSets() (*httptest.Server, error) {
	mux := http.NewServeMux()
	mux.HandleFunc("/api/v1/session/userinfo", func(w http.ResponseWriter, r *http.Request) {
		w.WriteHeader(200)
		_, _ = w.Write([]byte(`{}`))
	})
	mux.HandleFunc("/api/v1/applications", func(w http.ResponseWriter, r *http.Request) {
		w.Header().Set("Content-Type", "application/json")
		// Return apps with ownerReferences linking them to ApplicationSets
		_, _ = w.Write([]byte(wrapListResponse(`[
			{
				"metadata":{
					"name":"app-from-appset-1",
					"namespace":"argocd",
					"ownerReferences":[{"apiVersion":"argoproj.io/v1alpha1","kind":"ApplicationSet","name":"nerdy-demo","uid":"123"}]
				},
				"spec":{"project":"default","destination":{"name":"cluster-a","namespace":"default"}},
				"status":{"sync":{"status":"Synced"},"health":{"status":"Healthy"}}

View source record →

📰 Research Paper
Loading…
⏳ Fetching content…