iwarapter / gradle-openshift-plugin

Gradle plugin to integrate with OpenShift
Other
4 stars 6 forks source link

How to run integTest #4

Open mtbvang opened 6 years ago

mtbvang commented 6 years ago

I was wondering how to run the integTest locally?

./gradlew build integTest

Just gives

BUILD SUCCESSFUL in 0s 10 actionable tasks: 10 up-to-date

Even without oc cluster up I would expect that the tests would run and fail.

I'm interested in extending the plugin functionality.

iwarapter commented 6 years ago

Hmm when I run:

./gradlew clean build integTest

I get the following:

:integTest
objc[27381]: Class JavaLaunchHelper is implemented in both /Library/Java/JavaVirtualMachines/jdk1.8.0_60.jdk/Contents/Home/bin/java (0x10c2934c0) and /Library/Java/JavaVirtualMachines/jdk1.8.0_60.jdk/Contents/Home/jre/lib/libinstrument.dylib (0x10c31f4e0). One of the two will be used. Which one is undefined.

com.iadams.gradle.openshift.OpenShiftPluginIntegSpec > we can start a build FAILED
    io.fabric8.kubernetes.client.KubernetesClientException: An error has occurred.
        at io.fabric8.kubernetes.client.KubernetesClientException.launderThrowable(KubernetesClientException.java:61)
        at io.fabric8.kubernetes.client.KubernetesClientException.launderThrowable(KubernetesClientException.java:52)
        at io.fabric8.kubernetes.client.dsl.base.BaseOperation.get(BaseOperation.java:201)
        at com.iadams.gradle.openshift.OpenShiftPluginIntegSpec.setup(OpenShiftPluginIntegSpec.groovy:52)

        Caused by:
        java.net.ConnectException: Failed to connect to /127.0.0.1:8443
            at okhttp3.internal.connection.RealConnection.connectSocket(RealConnection.java:222)
            at okhttp3.internal.connection.RealConnection.connect(RealConnection.java:146)
            at okhttp3.internal.connection.StreamAllocation.findConnection(StreamAllocation.java:186)
            at okhttp3.internal.connection.StreamAllocation.findHealthyConnection(StreamAllocation.java:121)
            at okhttp3.internal.connection.StreamAllocation.newStream(StreamAllocation.java:100)
            at okhttp3.internal.connection.ConnectInterceptor.intercept(ConnectInterceptor.java:42)
            at okhttp3.internal.http.RealInterceptorChain.proceed(RealInterceptorChain.java:92)
            at okhttp3.internal.http.RealInterceptorChain.proceed(RealInterceptorChain.java:67)
            at okhttp3.internal.cache.CacheInterceptor.intercept(CacheInterceptor.java:93)
            at okhttp3.internal.http.RealInterceptorChain.proceed(RealInterceptorChain.java:92)
            at okhttp3.internal.http.RealInterceptorChain.proceed(RealInterceptorChain.java:67)
            at okhttp3.internal.http.BridgeInterceptor.intercept(BridgeInterceptor.java:93)
            at okhttp3.internal.http.RealInterceptorChain.proceed(RealInterceptorChain.java:92)
            at okhttp3.internal.http.RetryAndFollowUpInterceptor.intercept(RetryAndFollowUpInterceptor.java:120)
            at okhttp3.internal.http.RealInterceptorChain.proceed(RealInterceptorChain.java:92)
            at okhttp3.internal.http.RealInterceptorChain.proceed(RealInterceptorChain.java:67)
            at io.fabric8.openshift.client.internal.OpenShiftOAuthInterceptor.intercept(OpenShiftOAuthInterceptor.java:64)
            at okhttp3.internal.http.RealInterceptorChain.proceed(RealInterceptorChain.java:92)
            at okhttp3.internal.http.RealInterceptorChain.proceed(RealInterceptorChain.java:67)
            at okhttp3.RealCall.getResponseWithInterceptorChain(RealCall.java:179)
            at okhttp3.RealCall.execute(RealCall.java:63)
            at io.fabric8.kubernetes.client.dsl.base.OperationSupport.handleResponse(OperationSupport.java:239)
            at io.fabric8.kubernetes.client.dsl.base.OperationSupport.handleResponse(OperationSupport.java:234)
            at io.fabric8.kubernetes.client.dsl.base.OperationSupport.handleGet(OperationSupport.java:230)
            at io.fabric8.kubernetes.client.dsl.base.BaseOperation.handleGet(BaseOperation.java:745)
            at io.fabric8.kubernetes.client.dsl.base.BaseOperation.get(BaseOperation.java:194)
            ... 1 more

            Caused by:
            java.net.ConnectException: Connection refused
                at java.net.AbstractPlainSocketImpl.doConnect(AbstractPlainSocketImpl.java:350)
                at java.net.AbstractPlainSocketImpl.connectToAddress(AbstractPlainSocketImpl.java:206)
                at java.net.AbstractPlainSocketImpl.connect(AbstractPlainSocketImpl.java:188)
                at java.net.SocksSocketImpl.connect(SocksSocketImpl.java:392)
                at java.net.Socket.connect(Socket.java:589)
                at okhttp3.internal.platform.Platform.connectSocket(Platform.java:124)
                at okhttp3.internal.connection.RealConnection.connectSocket(RealConnection.java:220)
                ... 26 more

com.iadams.gradle.openshift.OpenShiftPluginIntegSpec > we can start a build and watch the logs SKIPPED

com.iadams.gradle.openshift.OpenShiftPluginIntegSpec > we can tag a built image SKIPPED

com.iadams.gradle.openshift.OpenShiftPluginIntegSpec > we can create a new deployment SKIPPED

com.iadams.gradle.openshift.OpenShiftPluginIntegSpec > we can trigger a new deployment of our image SKIPPED

com.iadams.gradle.openshift.OpenShiftPluginIntegSpec > we can create a configMap with a single file SKIPPED

com.iadams.gradle.openshift.OpenShiftPluginIntegSpec > we can create a configMap with a series of files SKIPPED

com.iadams.gradle.openshift.OpenShiftPluginIntegSpec > we can create a configMap with a directory SKIPPED

com.iadams.gradle.openshift.OpenShiftPluginIntegSpec > we can create a secret with a single file SKIPPED

com.iadams.gradle.openshift.OpenShiftPluginIntegSpec > we can create a secret with a series of files SKIPPED

com.iadams.gradle.openshift.OpenShiftPluginIntegSpec > we can create a secret with a directory SKIPPED

11 tests completed, 1 failed, 10 skipped
:integTest FAILED
:jacocoCombinedTestReport
:jacocoIntegTestReport

FAILURE: Build failed with an exception.

* What went wrong:
Execution failed for task ':integTest'.
> There were failing tests. See the report at: file:///Users/iwarapter/IdeaProjects/gradle-openshift-plugin/build/reports/integ/index.html

* Try:
Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output.

BUILD FAILED

Total time: 49.062 secs

Can you share the full build log?

mtbvang commented 6 years ago

Output of ./gradlew clean build integTest:

> Task :groovydoc
Trying to override old definition of task fileScanner

> Task :test

com.iadams.gradle.openshift.OpenshiftPluginSpec > the plugin has the task: #task SKIPPED

com.iadams.gradle.openshift.OpenshiftPluginSpec > apply creates openshift extension PASSED

com.iadams.gradle.openshift.OpenshiftPluginSpec > extension properties are mapped to packaging task PASSED

com.iadams.gradle.openshift.OpenshiftPluginSpec > apply does not throw exceptions PASSED

com.iadams.gradle.openshift.OpenshiftPluginSpec > apply is idempotent PASSED

com.iadams.gradle.openshift.OpenshiftPluginSpec > apply is fine on all levels of multiproject PASSED

com.iadams.gradle.openshift.OpenshiftPluginSpec > apply to multiple subprojects PASSED

com.iadams.gradle.openshift.tasks.OpenShiftCreateSecretTaskSpec > we can create a secret from a file PASSED

com.iadams.gradle.openshift.tasks.OpenShiftCreateSecretTaskSpec > we can create a secret from a directory PASSED

com.iadams.gradle.openshift.tasks.OpenShiftCreateSecretTaskSpec > we can create a secret from a file tree PASSED

com.iadams.gradle.openshift.tasks.OpenShiftCreateSecretTaskSpec > we can create a secret from a file collection PASSED

com.iadams.gradle.openshift.tasks.OpenShiftCreateSecretTaskSpec > misconfigured tasks error PASSED

com.iadams.gradle.openshift.tasks.StartBuildTaskSpec > we can trigger a build PASSED

com.iadams.gradle.openshift.tasks.StartBuildTaskSpec > we can trigger a build and create default imageStream and buildConfigs PASSED

com.iadams.gradle.openshift.tasks.AbstractOpenshiftTaskSpec > PerformLogin with oAuth token PASSED

com.iadams.gradle.openshift.tasks.AbstractOpenshiftTaskSpec > PerformLogin with basic auth PASSED

com.iadams.gradle.openshift.tasks.AbstractOpenshiftTaskSpec > PerformLogin with basic auth and disable cert verification PASSED

com.iadams.gradle.openshift.tasks.OpenShiftConfigMapTaskSpec > we can create a config map from a file PASSED

com.iadams.gradle.openshift.tasks.OpenShiftConfigMapTaskSpec > we can create a config map from a directory PASSED

com.iadams.gradle.openshift.tasks.OpenShiftConfigMapTaskSpec > we can create a config map from a file tree PASSED

com.iadams.gradle.openshift.tasks.OpenShiftConfigMapTaskSpec > we can create a config map from a file collection PASSED

com.iadams.gradle.openshift.tasks.OpenShiftConfigMapTaskSpec > misconfigured tasks error PASSED

com.iadams.gradle.openshift.tasks.OpenShiftStartDeploymentTaskSpec > we can trigger the latest deployment PASSED

com.iadams.gradle.openshift.tasks.OpenShiftTagTaskSpec > we can tag an imagestream PASSED

com.iadams.gradle.openshift.tasks.OpenShiftCreateDeploymentTaskSpec > we can create a deployment PASSED

BUILD SUCCESSFUL in 12s
11 actionable tasks: 10 executed, 1 up-to-date

Looks like it just runs the unit tests, which get called from the build task. integTest just seems to get ignored.

mtbvang commented 6 years ago

outupt of: ./gradlew integTest -i

Initialized native services in: /home/vang/.gradle/native
The client will now receive all logging from the daemon (pid: 30412). The daemon log file: /home/vang/.gradle/daemon/4.0.1/daemon-30412.out.log
Starting 9th build in daemon [uptime: 6 mins 29.309 secs, performance: 99%]
Using 8 worker leases.
Creating new cache for fileHashes, path /home/vang/code/gradle-openshift-plugin/.gradle/4.0.1/fileHashes/fileHashes.bin, access org.gradle.cache.internal.DefaultCacheAccess@4e5794bc
Creating new cache for plugin-use-metadata, path /home/vang/.gradle/caches/4.0.1/plugin-resolution/plugin-use-metadata.bin, access org.gradle.cache.internal.DefaultCacheAccess@76ab64d4
Creating new cache for client-status, path /home/vang/.gradle/caches/4.0.1/plugin-resolution/client-status.bin, access org.gradle.cache.internal.DefaultCacheAccess@76ab64d4
Starting Build
Settings evaluated using settings file '/home/vang/code/gradle-openshift-plugin/settings.gradle'.
Projects loaded. Root project using build file '/home/vang/code/gradle-openshift-plugin/build.gradle'.
Included projects: [root project 'gradle-openshift-plugin']

> Configure project :
Evaluating root project 'gradle-openshift-plugin' using build file '/home/vang/code/gradle-openshift-plugin/build.gradle'.
Creating new cache for metadata-1.1/results, path /home/vang/.gradle/caches/transforms-1/metadata-1.1/results.bin, access org.gradle.cache.internal.DefaultCacheAccess@3040b43
Creating new cache for metadata-2.23/module-metadata, path /home/vang/.gradle/caches/modules-2/metadata-2.23/module-metadata.bin, access org.gradle.cache.internal.DefaultCacheAccess@5d9759b2
Creating new cache for metadata-2.23/artifact-at-repository, path /home/vang/.gradle/caches/modules-2/metadata-2.23/artifact-at-repository.bin, access org.gradle.cache.internal.DefaultCacheAccess@5d9759b2

All projects evaluated.
Selected primary task 'integTestTarBall' from project :
Tasks to be executed: [task ':integTestTarBall']
Found class org.gradle.caching.local.internal.DirectoryBuildCacheServiceFactory registered for class org.gradle.caching.local.DirectoryBuildCache
Creating new cache for resourceHashesCache, path /home/vang/code/gradle-openshift-plugin/.gradle/4.0.1/fileHashes/resourceHashesCache.bin, access org.gradle.cache.internal.DefaultCacheAccess@4e5794bc
Creating new cache for fileSnapshots, path /home/vang/code/gradle-openshift-plugin/.gradle/4.0.1/taskHistory/fileSnapshots.bin, access org.gradle.cache.internal.DefaultCacheAccess@4228bcba
Creating new cache for taskHistory, path /home/vang/code/gradle-openshift-plugin/.gradle/4.0.1/taskHistory/taskHistory.bin, access org.gradle.cache.internal.DefaultCacheAccess@4228bcba
:integTestTarBall (Thread[Task worker,5,main]) started.

> Task :integTestTarBall
Putting task artifact state for task ':integTestTarBall' into context took 0.0 secs.
Skipping task ':integTestTarBall' as it is up-to-date (took 0.001 secs).

:integTestTarBall (Thread[Task worker,5,main]) completed. Took 0.001 secs.

BUILD SUCCESSFUL in 0s
1 actionable task: 1 up-to-date
Stopped 0 worker daemon(s).
iwarapter commented 6 years ago

So the integTestTarBall just creates a tar.gz with a Dockerfile with a simple js file todo a basic build/deployment. I originally set it up to create the tar.gz in the src/integTest/resources/docker-build/ can you check thats deleted first - in reality i need to refactor it to put the file directly in destinationDir = file('build/resources/integTest/docker-build'). Let me know if that gets you any further.