Skip to content

Commit

Permalink
fix: replace deprecated AddToScheme with Install, and deprecated Sche…
Browse files Browse the repository at this point in the history
…meGroupVersion with GroupVersion. (argoproj-labs#1066)

Signed-off-by: Cheng Fang <cfang@redhat.com>
  • Loading branch information
chengfang authored Nov 16, 2023
1 parent 000c4a7 commit 17064c9
Show file tree
Hide file tree
Showing 7 changed files with 25 additions and 25 deletions.
20 changes: 10 additions & 10 deletions controllers/argocd/custommapper_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -153,7 +153,7 @@ func TestReconcileArgoCD_tlsSecretMapperRepoServer(t *testing.T) {
resObjs := []client.Object{argocd, secret, service}
subresObjs := []client.Object{argocd}
runtimeObjs := []runtime.Object{}
sch := makeTestReconcilerScheme(argoproj.AddToScheme, configv1.AddToScheme, routev1.AddToScheme)
sch := makeTestReconcilerScheme(argoproj.AddToScheme, configv1.Install, routev1.Install)
cl := makeTestReconcilerClient(sch, resObjs, subresObjs, runtimeObjs)
r := makeTestReconciler(cl, sch)

Expand Down Expand Up @@ -210,7 +210,7 @@ func TestReconcileArgoCD_tlsSecretMapperRepoServer(t *testing.T) {
resObjs := []client.Object{argocd, secret}
subresObjs := []client.Object{argocd}
runtimeObjs := []runtime.Object{}
sch := makeTestReconcilerScheme(argoproj.AddToScheme, configv1.AddToScheme, routev1.AddToScheme)
sch := makeTestReconcilerScheme(argoproj.AddToScheme, configv1.Install, routev1.Install)
cl := makeTestReconcilerClient(sch, resObjs, subresObjs, runtimeObjs)
r := makeTestReconciler(cl, sch)

Expand Down Expand Up @@ -260,7 +260,7 @@ func TestReconcileArgoCD_tlsSecretMapperRepoServer(t *testing.T) {
resObjs := []client.Object{argocd, secret, service}
subresObjs := []client.Object{argocd}
runtimeObjs := []runtime.Object{}
sch := makeTestReconcilerScheme(argoproj.AddToScheme, configv1.AddToScheme, routev1.AddToScheme)
sch := makeTestReconcilerScheme(argoproj.AddToScheme, configv1.Install, routev1.Install)
cl := makeTestReconcilerClient(sch, resObjs, subresObjs, runtimeObjs)
r := makeTestReconciler(cl, sch)

Expand Down Expand Up @@ -290,7 +290,7 @@ func TestReconcileArgoCD_tlsSecretMapperRepoServer(t *testing.T) {
resObjs := []client.Object{argocd, secret}
subresObjs := []client.Object{argocd}
runtimeObjs := []runtime.Object{}
sch := makeTestReconcilerScheme(argoproj.AddToScheme, configv1.AddToScheme, routev1.AddToScheme)
sch := makeTestReconcilerScheme(argoproj.AddToScheme, configv1.Install, routev1.Install)
cl := makeTestReconcilerClient(sch, resObjs, subresObjs, runtimeObjs)
r := makeTestReconciler(cl, sch)

Expand Down Expand Up @@ -324,7 +324,7 @@ func TestReconcileArgoCD_tlsSecretMapperRepoServer(t *testing.T) {
resObjs := []client.Object{argocd, secret}
subresObjs := []client.Object{argocd}
runtimeObjs := []runtime.Object{}
sch := makeTestReconcilerScheme(argoproj.AddToScheme, configv1.AddToScheme, routev1.AddToScheme)
sch := makeTestReconcilerScheme(argoproj.AddToScheme, configv1.Install, routev1.Install)
cl := makeTestReconcilerClient(sch, resObjs, subresObjs, runtimeObjs)
r := makeTestReconciler(cl, sch)

Expand Down Expand Up @@ -385,7 +385,7 @@ func TestReconcileArgoCD_tlsSecretMapperRedis(t *testing.T) {
resObjs := []client.Object{argocd, secret, service}
subresObjs := []client.Object{argocd}
runtimeObjs := []runtime.Object{}
sch := makeTestReconcilerScheme(argoproj.AddToScheme, configv1.AddToScheme, routev1.AddToScheme)
sch := makeTestReconcilerScheme(argoproj.AddToScheme, configv1.Install, routev1.Install)
cl := makeTestReconcilerClient(sch, resObjs, subresObjs, runtimeObjs)
r := makeTestReconciler(cl, sch)

Expand Down Expand Up @@ -442,7 +442,7 @@ func TestReconcileArgoCD_tlsSecretMapperRedis(t *testing.T) {
resObjs := []client.Object{argocd, secret}
subresObjs := []client.Object{argocd}
runtimeObjs := []runtime.Object{}
sch := makeTestReconcilerScheme(argoproj.AddToScheme, configv1.AddToScheme, routev1.AddToScheme)
sch := makeTestReconcilerScheme(argoproj.AddToScheme, configv1.Install, routev1.Install)
cl := makeTestReconcilerClient(sch, resObjs, subresObjs, runtimeObjs)
r := makeTestReconciler(cl, sch)

Expand Down Expand Up @@ -492,7 +492,7 @@ func TestReconcileArgoCD_tlsSecretMapperRedis(t *testing.T) {
resObjs := []client.Object{argocd, secret, service}
subresObjs := []client.Object{argocd}
runtimeObjs := []runtime.Object{}
sch := makeTestReconcilerScheme(argoproj.AddToScheme, configv1.AddToScheme, routev1.AddToScheme)
sch := makeTestReconcilerScheme(argoproj.AddToScheme, configv1.Install, routev1.Install)
cl := makeTestReconcilerClient(sch, resObjs, subresObjs, runtimeObjs)
r := makeTestReconciler(cl, sch)

Expand Down Expand Up @@ -522,7 +522,7 @@ func TestReconcileArgoCD_tlsSecretMapperRedis(t *testing.T) {
resObjs := []client.Object{argocd, secret}
subresObjs := []client.Object{argocd}
runtimeObjs := []runtime.Object{}
sch := makeTestReconcilerScheme(argoproj.AddToScheme, configv1.AddToScheme, routev1.AddToScheme)
sch := makeTestReconcilerScheme(argoproj.AddToScheme, configv1.Install, routev1.Install)
cl := makeTestReconcilerClient(sch, resObjs, subresObjs, runtimeObjs)
r := makeTestReconciler(cl, sch)

Expand Down Expand Up @@ -556,7 +556,7 @@ func TestReconcileArgoCD_tlsSecretMapperRedis(t *testing.T) {
resObjs := []client.Object{argocd, secret}
subresObjs := []client.Object{argocd}
runtimeObjs := []runtime.Object{}
sch := makeTestReconcilerScheme(argoproj.AddToScheme, configv1.AddToScheme, routev1.AddToScheme)
sch := makeTestReconcilerScheme(argoproj.AddToScheme, configv1.Install, routev1.Install)
cl := makeTestReconcilerClient(sch, resObjs, subresObjs, runtimeObjs)
r := makeTestReconciler(cl, sch)

Expand Down
4 changes: 2 additions & 2 deletions controllers/argocd/keycloak_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -354,7 +354,7 @@ func TestKeycloak_testServerCert(t *testing.T) {
resObjs := []client.Object{a}
subresObjs := []client.Object{a}
runtimeObjs := []runtime.Object{}
sch := makeTestReconcilerScheme(argoproj.AddToScheme, templatev1.AddToScheme, oappsv1.AddToScheme, routev1.AddToScheme)
sch := makeTestReconcilerScheme(argoproj.AddToScheme, templatev1.Install, oappsv1.Install, routev1.Install)
cl := makeTestReconcilerClient(sch, resObjs, subresObjs, runtimeObjs)
r := makeTestReconciler(cl, sch)

Expand Down Expand Up @@ -426,7 +426,7 @@ func TestKeycloakConfigVerifyTLSForOpenShift(t *testing.T) {
resObjs := []client.Object{test.argoCD}
subresObjs := []client.Object{test.argoCD}
runtimeObjs := []runtime.Object{}
sch := makeTestReconcilerScheme(argoproj.AddToScheme, templatev1.AddToScheme, oappsv1.AddToScheme, routev1.AddToScheme)
sch := makeTestReconcilerScheme(argoproj.AddToScheme, templatev1.Install, oappsv1.Install, routev1.Install)
cl := makeTestReconcilerClient(sch, resObjs, subresObjs, runtimeObjs)
r := makeTestReconciler(cl, sch)

Expand Down
6 changes: 3 additions & 3 deletions controllers/argocd/route_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ func TestReconcileRouteSetLabels(t *testing.T) {
resObjs := []client.Object{argoCD}
subresObjs := []client.Object{argoCD}
runtimeObjs := []runtime.Object{}
sch := makeTestReconcilerScheme(argoproj.AddToScheme, configv1.AddToScheme, routev1.AddToScheme)
sch := makeTestReconcilerScheme(argoproj.AddToScheme, configv1.Install, routev1.Install)
cl := makeTestReconcilerClient(sch, resObjs, subresObjs, runtimeObjs)
r := makeTestReconciler(cl, sch)

Expand Down Expand Up @@ -73,7 +73,7 @@ func TestReconcileRouteSetsInsecure(t *testing.T) {
resObjs := []client.Object{argoCD}
subresObjs := []client.Object{argoCD}
runtimeObjs := []runtime.Object{}
sch := makeTestReconcilerScheme(argoproj.AddToScheme, configv1.AddToScheme, routev1.AddToScheme)
sch := makeTestReconcilerScheme(argoproj.AddToScheme, configv1.Install, routev1.Install)
cl := makeTestReconcilerClient(sch, resObjs, subresObjs, runtimeObjs)
r := makeTestReconciler(cl, sch)

Expand Down Expand Up @@ -149,7 +149,7 @@ func TestReconcileRouteUnsetsInsecure(t *testing.T) {
resObjs := []client.Object{argoCD}
subresObjs := []client.Object{argoCD}
runtimeObjs := []runtime.Object{}
sch := makeTestReconcilerScheme(argoproj.AddToScheme, configv1.AddToScheme, routev1.AddToScheme)
sch := makeTestReconcilerScheme(argoproj.AddToScheme, configv1.Install, routev1.Install)
cl := makeTestReconcilerClient(sch, resObjs, subresObjs, runtimeObjs)
r := makeTestReconciler(cl, sch)

Expand Down
4 changes: 2 additions & 2 deletions controllers/argocd/secret_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -120,7 +120,7 @@ func Test_ReconcileArgoCD_ReconcileRepoTLSSecret(t *testing.T) {
repoDepl,
ctrlSts}
runtimeObjs := []runtime.Object{}
sch := makeTestReconcilerScheme(argoproj.AddToScheme, configv1.AddToScheme, routev1.AddToScheme)
sch := makeTestReconcilerScheme(argoproj.AddToScheme, configv1.Install, routev1.Install)
cl := makeTestReconcilerClient(sch, resObjs, subresObjs, runtimeObjs)
r := makeTestReconciler(cl, sch)

Expand Down Expand Up @@ -329,7 +329,7 @@ func Test_ReconcileArgoCD_ReconcileRedisTLSSecret(t *testing.T) {
ctrlSts,
redisDepl}
runtimeObjs := []runtime.Object{}
sch := makeTestReconcilerScheme(argoproj.AddToScheme, configv1.AddToScheme, routev1.AddToScheme)
sch := makeTestReconcilerScheme(argoproj.AddToScheme, configv1.Install, routev1.Install)
cl := makeTestReconcilerClient(sch, resObjs, subresObjs, runtimeObjs)
r := makeTestReconciler(cl, sch)

Expand Down
2 changes: 1 addition & 1 deletion controllers/argocd/sso.go
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ func IsTemplateAPIAvailable() bool {

// verifyTemplateAPI will verify that the template API is present.
func verifyTemplateAPI() error {
found, err := argoutil.VerifyAPI(template.SchemeGroupVersion.Group, template.SchemeGroupVersion.Version)
found, err := argoutil.VerifyAPI(template.GroupVersion.Group, template.GroupVersion.Version)
if err != nil {
return err
}
Expand Down
10 changes: 5 additions & 5 deletions controllers/argocd/sso_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ func TestReconcile_testKeycloakTemplateInstance(t *testing.T) {
resObjs := []client.Object{a}
subresObjs := []client.Object{a}
runtimeObjs := []runtime.Object{}
sch := makeTestReconcilerScheme(argoproj.AddToScheme, templatev1.AddToScheme, oappsv1.AddToScheme, routev1.AddToScheme)
sch := makeTestReconcilerScheme(argoproj.AddToScheme, templatev1.Install, oappsv1.Install, routev1.Install)
cl := makeTestReconcilerClient(sch, resObjs, subresObjs, runtimeObjs)
r := makeTestReconciler(cl, sch)

Expand All @@ -69,7 +69,7 @@ func TestReconcile_noTemplateInstance(t *testing.T) {
resObjs := []client.Object{a}
subresObjs := []client.Object{a}
runtimeObjs := []runtime.Object{}
sch := makeTestReconcilerScheme(argoproj.AddToScheme, templatev1.AddToScheme, oappsv1.AddToScheme, routev1.AddToScheme)
sch := makeTestReconcilerScheme(argoproj.AddToScheme, templatev1.Install, oappsv1.Install, routev1.Install)
cl := makeTestReconcilerClient(sch, resObjs, subresObjs, runtimeObjs)
r := makeTestReconciler(cl, sch)

Expand Down Expand Up @@ -215,7 +215,7 @@ func TestReconcile_illegalSSOConfiguration(t *testing.T) {
resObjs := []client.Object{test.argoCD}
subresObjs := []client.Object{test.argoCD}
runtimeObjs := []runtime.Object{}
sch := makeTestReconcilerScheme(argoproj.AddToScheme, templatev1.AddToScheme, oappsv1.AddToScheme, routev1.AddToScheme)
sch := makeTestReconcilerScheme(argoproj.AddToScheme, templatev1.Install, oappsv1.Install, routev1.Install)
cl := makeTestReconcilerClient(sch, resObjs, subresObjs, runtimeObjs)
r := makeTestReconciler(cl, sch)

Expand Down Expand Up @@ -254,7 +254,7 @@ func TestReconcile_testKeycloakK8sInstance(t *testing.T) {
resObjs := []client.Object{a}
subresObjs := []client.Object{a}
runtimeObjs := []runtime.Object{}
sch := makeTestReconcilerScheme(argoproj.AddToScheme, templatev1.AddToScheme, oappsv1.AddToScheme, routev1.AddToScheme)
sch := makeTestReconcilerScheme(argoproj.AddToScheme, templatev1.Install, oappsv1.Install, routev1.Install)
cl := makeTestReconcilerClient(sch, resObjs, subresObjs, runtimeObjs)
r := makeTestReconciler(cl, sch)

Expand All @@ -273,7 +273,7 @@ func TestReconcile_testKeycloakInstanceResources(t *testing.T) {
resObjs := []client.Object{a}
subresObjs := []client.Object{a}
runtimeObjs := []runtime.Object{}
sch := makeTestReconcilerScheme(argoproj.AddToScheme, templatev1.AddToScheme, oappsv1.AddToScheme, routev1.AddToScheme)
sch := makeTestReconcilerScheme(argoproj.AddToScheme, templatev1.Install, oappsv1.Install, routev1.Install)
cl := makeTestReconcilerClient(sch, resObjs, subresObjs, runtimeObjs)
r := makeTestReconciler(cl, sch)

Expand Down
4 changes: 2 additions & 2 deletions controllers/argocd/status_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@ func TestReconcileArgoCD_reconcileStatusKeycloak_OpenShift(t *testing.T) {

assert.NoError(t, createNamespace(r, a.Namespace, ""))

assert.NoError(t, oappsv1.AddToScheme(r.Scheme))
assert.NoError(t, oappsv1.Install(r.Scheme))
templateAPIFound = true
defer removeTemplateAPI()

Expand Down Expand Up @@ -255,7 +255,7 @@ func TestReconcileArgoCD_reconcileStatusHost(t *testing.T) {
resObjs := []client.Object{a}
subresObjs := []client.Object{a}
runtimeObjs := []runtime.Object{}
sch := makeTestReconcilerScheme(argoproj.AddToScheme, configv1.AddToScheme, routev1.AddToScheme)
sch := makeTestReconcilerScheme(argoproj.AddToScheme, configv1.Install, routev1.Install)
cl := makeTestReconcilerClient(sch, resObjs, subresObjs, runtimeObjs)
r := makeTestReconciler(cl, sch)

Expand Down

0 comments on commit 17064c9

Please sign in to comment.