Skip to content

Commit

Permalink
revert commented test case
Browse files Browse the repository at this point in the history
Signed-off-by: ishitasequeira <ishiseq29@gmail.com>
  • Loading branch information
ishitasequeira committed Aug 23, 2023
1 parent f4b46ff commit 2a1eb95
Show file tree
Hide file tree
Showing 2 changed files with 54 additions and 54 deletions.
106 changes: 53 additions & 53 deletions test/e2e/api_versions_test.go
Original file line number Diff line number Diff line change
@@ -1,57 +1,57 @@
package e2e

// import (
// "testing"
import (
"testing"

// . "github.com/argoproj/argo-cd/v2/pkg/apis/application/v1alpha1"
// . "github.com/argoproj/argo-cd/v2/test/e2e/fixture/app"
// )
. "github.com/argoproj/argo-cd/v2/pkg/apis/application/v1alpha1"
. "github.com/argoproj/argo-cd/v2/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 argoproj\.io/Fake for requested resource [a-z0-9-]+/fake-crd-instance\. Version "v1alpha1" of argoproj\.io/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 argoproj\.io/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.argoproj.io "" not found`))
// }
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 argoproj\.io/Fake for requested resource [a-z0-9-]+/fake-crd-instance\. Version "v1alpha1" of argoproj\.io/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 argoproj\.io/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.argoproj.io "" not found`))
}
2 changes: 1 addition & 1 deletion util/settings/settings.go
Original file line number Diff line number Diff line change
Expand Up @@ -682,7 +682,7 @@ func (mgr *SettingsManager) GetConfigMapByName(configMapName string) (*apiv1.Con
if err != nil {
return nil, err
}
return configMap, nil
return configMap, err
}

func (mgr *SettingsManager) GetResourcesFilter() (*ResourcesFilter, error) {
Expand Down

0 comments on commit 2a1eb95

Please sign in to comment.