Skip to content

Commit

Permalink
Fix tests
Browse files Browse the repository at this point in the history
Signed-off-by: Anatolii Bazko <abazko@redhat.com>
  • Loading branch information
tolusha committed Jul 28, 2021
1 parent a3a3b58 commit 45920a4
Show file tree
Hide file tree
Showing 4 changed files with 8 additions and 20 deletions.
2 changes: 1 addition & 1 deletion config/samples/org.eclipse.che_v1_checluster.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -136,7 +136,7 @@ spec:
oAuthSecret: ''
k8s:
# Global ingress domain for a Kubernetes cluster.
ingressDomain: '192.168.99.100.nip.io'
ingressDomain: '192.168.99.101.nip.io'
# Ingress class that will define the which controller will manage ingresses. Defaults to `nginx`.
# NB: This drives the `kubernetes.io/ingress.class` annotation on Che-related ingresses.
ingressClass: ''
Expand Down
6 changes: 5 additions & 1 deletion controllers/che/checluster_controller_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -869,6 +869,7 @@ func TestImagePullerConfiguration(t *testing.T) {
Namespace: namespace,
},
}

_, err := r.Reconcile(req)
if err != nil {
t.Fatalf("Error reconciling: %v", err)
Expand Down Expand Up @@ -901,9 +902,12 @@ func TestImagePullerConfiguration(t *testing.T) {
if err != nil {
t.Errorf("Error getting CheCluster: %v", err)
}
if !reflect.DeepEqual(testCase.expectedCR, gotCR) {
if !reflect.DeepEqual(testCase.expectedCR.Spec.ImagePuller, gotCR.Spec.ImagePuller) {
t.Errorf("Expected CR and CR returned from API server are different (-want +got): %v", cmp.Diff(testCase.expectedCR, gotCR))
}
if testCase.expectedCR.Spec.ImagePuller.Enable && !util.ContainsString(testCase.expectedCR.ObjectMeta.Finalizers, "kubernetesimagepullers.finalizers.che.eclipse.org") {
t.Errorf("kubernetesimagepullers.finalizers.che.eclipse.org finalizer was not added.")
}
}
if testCase.expectedImagePuller != nil {
gotImagePuller := &chev1alpha1.KubernetesImagePuller{}
Expand Down
10 changes: 1 addition & 9 deletions controllers/che/proxy_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -318,21 +318,13 @@ func TestReadProxyConfiguration(t *testing.T) {
scheme.AddKnownTypes(configv1.SchemeGroupVersion, &configv1.Proxy{})

cli := fake.NewFakeClientWithScheme(scheme, testCase.initObjects...)
nonCachedClient := fake.NewFakeClientWithScheme(scheme, testCase.initObjects...)
clientSet := fakeclientset.NewSimpleClientset()
fakeDiscovery, _ := clientSet.Discovery().(*fakeDiscovery.FakeDiscovery)
fakeDiscovery.Fake.Resources = []*metav1.APIResourceList{}

os.Setenv("OPENSHIFT_VERSION", testCase.openShiftVersion)
util.IsOpenShift, util.IsOpenShift4, _ = util.DetectOpenShift()

r := &CheClusterReconciler{
client: cli,
nonCachedClient: nonCachedClient,
discoveryClient: fakeDiscovery,
Scheme: scheme,
}

deployContext := &deploy.DeployContext{
CheCluster: testCase.cheCluster,
ClusterAPI: deploy.ClusterAPI{
Expand All @@ -342,7 +334,7 @@ func TestReadProxyConfiguration(t *testing.T) {
},
}

actualProxyConf, err := r.getProxyConfiguration(deployContext)
actualProxyConf, err := getProxyConfiguration(deployContext)
if err != nil {
t.Fatalf("Error reading proxy configuration: %v", err)
}
Expand Down
10 changes: 1 addition & 9 deletions controllers/che/workspace_namespace_permission_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -23,15 +23,7 @@ import (

func TestReconcileWorkspacePermissions(t *testing.T) {
deployContext := deploy.GetTestDeployContext(nil, []runtime.Object{})
reconciler := &CheClusterReconciler{
client: deployContext.ClusterAPI.Client,
nonCachedClient: deployContext.ClusterAPI.Client,
discoveryClient: deployContext.ClusterAPI.DiscoveryClient,
Scheme: deployContext.ClusterAPI.Scheme,
tests: true,
}

done, err := reconciler.reconcileWorkspacePermissions(deployContext)
done, err := reconcileWorkspacePermissions(deployContext)
if err != nil {
t.Fatalf("Failed to reconcile permissions: %v", err)
}
Expand Down

0 comments on commit 45920a4

Please sign in to comment.