Resolve some FIXME
This commit is contained in:
parent
524d0b861f
commit
363b9e0fc0
2
Makefile
2
Makefile
|
|
@ -92,7 +92,7 @@ test: ## Runs the go tests
|
|||
e2e: deepcopy-gen ## Runs e2e tests, you can use EXTRA_ARGS
|
||||
@echo "+ $@"
|
||||
RUNNING_TESTS=1 go test -parallel=1 "./test/e2e/" -tags "$(BUILDTAGS) cgo" -v -timeout 60m -run "$(E2E_TEST_SELECTOR)" \
|
||||
$(TEST_ARGS)
|
||||
-jenkins-api-hostname=$(JENKINS_API_HOSTNAME) -jenkins-api-port=$(JENKINS_API_PORT) -jenkins-api-use-nodeport=$(JENKINS_API_USE_NODEPORT) $(E2E_TEST_ARGS)
|
||||
|
||||
.PHONY: vet
|
||||
vet: ## Verifies `go vet` passes
|
||||
|
|
|
|||
|
|
@ -2,7 +2,9 @@ package controllers
|
|||
|
||||
import (
|
||||
"fmt"
|
||||
"reflect"
|
||||
|
||||
"github.com/jenkinsci/kubernetes-operator/api/v1alpha2"
|
||||
"github.com/jenkinsci/kubernetes-operator/pkg/constants"
|
||||
"github.com/jenkinsci/kubernetes-operator/pkg/log"
|
||||
|
||||
|
|
@ -10,6 +12,7 @@ import (
|
|||
"k8s.io/apimachinery/pkg/types"
|
||||
"k8s.io/client-go/util/workqueue"
|
||||
"sigs.k8s.io/controller-runtime/pkg/event"
|
||||
"sigs.k8s.io/controller-runtime/pkg/handler"
|
||||
"sigs.k8s.io/controller-runtime/pkg/reconcile"
|
||||
)
|
||||
|
||||
|
|
@ -72,8 +75,7 @@ func (e *enqueueRequestForJenkins) getOwnerReconcileRequests(object metav1.Objec
|
|||
return nil
|
||||
}
|
||||
|
||||
// FIXME unused
|
||||
/*type jenkinsDecorator struct {
|
||||
type jenkinsDecorator struct {
|
||||
handler handler.EventHandler
|
||||
}
|
||||
|
||||
|
|
@ -95,4 +97,4 @@ func (e *jenkinsDecorator) Delete(evt event.DeleteEvent, q workqueue.RateLimitin
|
|||
|
||||
func (e *jenkinsDecorator) Generic(evt event.GenericEvent, q workqueue.RateLimitingInterface) {
|
||||
e.handler.Generic(evt, q)
|
||||
}*/
|
||||
}
|
||||
|
|
|
|||
|
|
@ -44,6 +44,7 @@ import (
|
|||
"k8s.io/client-go/rest"
|
||||
ctrl "sigs.k8s.io/controller-runtime"
|
||||
"sigs.k8s.io/controller-runtime/pkg/client"
|
||||
"sigs.k8s.io/controller-runtime/pkg/handler"
|
||||
"sigs.k8s.io/controller-runtime/pkg/reconcile"
|
||||
"sigs.k8s.io/controller-runtime/pkg/source"
|
||||
)
|
||||
|
|
@ -80,6 +81,7 @@ func (r *JenkinsReconciler) SetupWithManager(mgr ctrl.Manager) error {
|
|||
jenkinsHandler := &enqueueRequestForJenkins{}
|
||||
configMapResource := &source.Kind{Type: &corev1.ConfigMap{TypeMeta: metav1.TypeMeta{APIVersion: APIVersion, Kind: ConfigMapKind}}}
|
||||
secretResource := &source.Kind{Type: &corev1.Secret{TypeMeta: metav1.TypeMeta{APIVersion: APIVersion, Kind: SecretKind}}}
|
||||
decorator := jenkinsDecorator{handler: &handler.EnqueueRequestForObject{}}
|
||||
return ctrl.NewControllerManagedBy(mgr).
|
||||
For(&v1alpha2.Jenkins{}).
|
||||
Owns(&corev1.Pod{}).
|
||||
|
|
@ -87,6 +89,7 @@ func (r *JenkinsReconciler) SetupWithManager(mgr ctrl.Manager) error {
|
|||
Owns(&corev1.ConfigMap{}).
|
||||
Watches(secretResource, jenkinsHandler).
|
||||
Watches(configMapResource, jenkinsHandler).
|
||||
Watches(&source.Kind{Type: &v1alpha2.Jenkins{}}, &decorator).
|
||||
Complete(r)
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -68,4 +68,4 @@ func TestDeployHelmChart(t *testing.T) {
|
|||
waitForJenkinsBaseConfigurationToComplete(t, jenkins)
|
||||
waitForJenkinsUserConfigurationToComplete(t, jenkins)
|
||||
}
|
||||
/*
|
||||
*/
|
||||
|
|
|
|||
|
|
@ -102,4 +102,4 @@ func updateJenkinsCR(t *testing.T, jenkins *v1alpha2.Jenkins) {
|
|||
jenkins.Spec.Master.Plugins = jenkins.Spec.Master.Plugins[0:3] // remove devoptics plugin
|
||||
}
|
||||
}
|
||||
*/
|
||||
*/
|
||||
|
|
|
|||
|
|
@ -90,9 +90,9 @@ jenkins.save()
|
|||
func checkIfAuthorizationStrategyUnsecuredIsSet(t *testing.T, jenkinsClient jenkinsclient.Jenkins) {
|
||||
logs, err := jenkinsClient.ExecuteScript(`
|
||||
import hudson.security.*
|
||||
|
||||
|
||||
def jenkins = jenkins.model.Jenkins.getInstance()
|
||||
|
||||
|
||||
if (!(jenkins.getAuthorizationStrategy() instanceof AuthorizationStrategy.Unsecured)) {
|
||||
throw new Exception('AuthorizationStrategy.Unsecured is not set')
|
||||
}
|
||||
|
|
@ -111,4 +111,4 @@ func checkBaseConfigurationCompleteTimeIsNotSet(t *testing.T, jenkins *v1alpha2.
|
|||
t.Fatalf("Status.BaseConfigurationCompletedTime is set after pod restart, status %+v", jenkinsStatus.Status)
|
||||
}
|
||||
}
|
||||
*/
|
||||
*/
|
||||
|
|
|
|||
|
|
@ -216,4 +216,4 @@ func resetJenkinsStatus(t *testing.T, jenkins *v1alpha2.Jenkins) {
|
|||
err := framework.Global.Client.Update(context.TODO(), jenkins)
|
||||
require.NoError(t, err)
|
||||
}
|
||||
*/
|
||||
*/
|
||||
|
|
|
|||
|
|
@ -2,6 +2,7 @@ package e2e
|
|||
|
||||
import (
|
||||
"context"
|
||||
"flag"
|
||||
"fmt"
|
||||
"path/filepath"
|
||||
"testing"
|
||||
|
|
@ -35,8 +36,18 @@ var (
|
|||
cfg *rest.Config
|
||||
k8sClient client.Client
|
||||
testEnv *envtest.Environment
|
||||
|
||||
hostname *string
|
||||
port *int
|
||||
useNodePort *bool
|
||||
)
|
||||
|
||||
func init() {
|
||||
hostname = flag.String("jenkins-api-hostname", "", "Hostname or IP of Jenkins API. It can be service name, node IP or localhost.")
|
||||
port = flag.Int("jenkins-api-port", 0, "The port on which Jenkins API is running. Note: If you want to use nodePort don't set this setting and --jenkins-api-use-nodeport must be true.")
|
||||
useNodePort = flag.Bool("jenkins-api-use-nodeport", false, "Connect to Jenkins API using the service nodePort instead of service port. If you want to set this as true - don't set --jenkins-api-port.")
|
||||
}
|
||||
|
||||
func TestAPIs(t *testing.T) {
|
||||
RegisterFailHandler(Fail)
|
||||
|
||||
|
|
@ -83,8 +94,9 @@ var _ = BeforeSuite(func(done Done) {
|
|||
go notifications.Listen(notificationEvents, events, k8sClient)
|
||||
|
||||
jenkinsAPIConnectionSettings := jenkinsClient.JenkinsAPIConnectionSettings{
|
||||
Hostname: "192.168.99.100", // FIXME minikube ip
|
||||
UseNodePort: true,
|
||||
Hostname: *hostname,
|
||||
UseNodePort: *useNodePort,
|
||||
Port: *port,
|
||||
}
|
||||
|
||||
err = (&controllers.JenkinsReconciler{
|
||||
|
|
|
|||
Loading…
Reference in New Issue