-
Notifications
You must be signed in to change notification settings - Fork 20
✨ Add comprehensive integration test suite with CI/CD pipeline #168
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Open
shawn-hurley
wants to merge
9
commits into
konveyor:main
Choose a base branch
from
shawn-hurley:feature/upgrade-to-latest-jdtls
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
Show all changes
9 commits
Select commit
Hold shift + click to select a range
dbbebb6
Add comprehensive integration test suite with CI/CD pipeline
shawn-hurley c007dc5
remove runtime .metadata folder
shawn-hurley 950010d
Commiting the specific changes for getting the integration tests working
shawn-hurley d584cff
claude fixing tests
shawn-hurley 6733d51
another round of claude generation for the tests
shawn-hurley 5239567
fixing up more tests
shawn-hurley 50e7c43
claude fixed itself
shawn-hurley 72d3537
removing un-necessary change
shawn-hurley 337aa9e
updating JDTLS with comfort because of the tests
shawn-hurley File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,72 @@ | ||
| name: Phase 2 Integration Tests | ||
|
|
||
| on: | ||
| push: | ||
| branches: [ main, maven-index ] | ||
| pull_request: | ||
| branches: [ main ] | ||
|
|
||
| jobs: | ||
| unit-tests: | ||
| name: Unit Tests (Phase 1) | ||
| runs-on: ubuntu-latest | ||
| steps: | ||
| - uses: actions/checkout@v4 | ||
|
|
||
| - name: Set up JDK 17 | ||
| uses: actions/setup-java@v4 | ||
| with: | ||
| java-version: '17' | ||
| distribution: 'temurin' | ||
| cache: maven | ||
|
|
||
| - name: Run unit tests | ||
| run: mvn clean integration-test | ||
|
|
||
| - name: Upload test results | ||
| if: always() | ||
| uses: actions/upload-artifact@v4 | ||
| with: | ||
| name: unit-test-results | ||
| path: | | ||
| **/target/surefire-reports/*.xml | ||
| **/target/surefire-reports/*.txt | ||
|
|
||
| jdtls-integration-tests: | ||
| name: JDT.LS Integration Tests (Phase 2) | ||
| runs-on: ubuntu-latest | ||
| needs: unit-tests | ||
|
|
||
| steps: | ||
| - uses: actions/checkout@v4 | ||
|
|
||
| - name: Set up Go | ||
| uses: actions/setup-go@v5 | ||
| with: | ||
| go-version: '1.23.9' | ||
|
|
||
| - name: Install Podman | ||
| run: | | ||
| sudo apt-get update | ||
| sudo apt-get -y install podman | ||
|
|
||
| - name: Verify Podman installation | ||
| run: | | ||
| podman --version | ||
| podman info | ||
|
|
||
| - name: Build JDT.LS container image with Podman | ||
| run: | | ||
| podman build -t jdtls-analyzer:test . | ||
|
|
||
| - name: Run Phase 2 integration tests in container | ||
| run: | | ||
| podman run --rm \ | ||
| -v $(pwd)/java-analyzer-bundle.test:/tests:Z \ | ||
| -e WORKSPACE_DIR=/tests/projects \ | ||
| -e JDTLS_PATH=/jdtls \ | ||
| --workdir /tests/integration \ | ||
| --entrypoint /bin/sh \ | ||
| jdtls-analyzer:test \ | ||
| -c "microdnf install -y golang && cd /tests/integration && go mod download && go test -v" | ||
| timeout-minutes: 15 | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -4,3 +4,4 @@ target/ | |
| *.iml | ||
| .DS_Store | ||
| .gradle/ | ||
| */projects/.metadata | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,53 @@ | ||
| FROM registry.access.redhat.com/ubi9/ubi AS jdtls-download | ||
| WORKDIR /jdtls | ||
| RUN curl -s -o jdtls.tar.gz https://download.eclipse.org/jdtls/milestones/1.50.0/jdt-language-server-1.50.0-202509041425.tar.gz &&\ | ||
| tar -xvf jdtls.tar.gz --no-same-owner &&\ | ||
| chmod 755 /jdtls/bin/jdtls &&\ | ||
| rm -rf jdtls.tar.gz | ||
|
|
||
| COPY jdtls-bin-override/jdtls.py /jdtls/bin/jdtls.py | ||
|
|
||
| FROM registry.access.redhat.com/ubi9/ubi AS maven-index | ||
| COPY hack/maven.default.index /maven.default.index | ||
|
|
||
| FROM registry.access.redhat.com/ubi9/ubi AS fernflower | ||
| RUN dnf install -y maven-openjdk17 wget --setopt=install_weak_deps=False && dnf clean all && rm -rf /var/cache/dnf | ||
| RUN wget --quiet https://github.com/JetBrains/intellij-community/archive/refs/tags/idea/231.9011.34.tar.gz -O intellij-community.tar && tar xf intellij-community.tar intellij-community-idea-231.9011.34/plugins/java-decompiler/engine && rm -rf intellij-community.tar | ||
| WORKDIR /intellij-community-idea-231.9011.34/plugins/java-decompiler/engine | ||
| RUN export JAVA_HOME=/usr/lib/jvm/java-17-openjdk | ||
| RUN ./gradlew build -x test && rm -rf /root/.gradle | ||
| RUN mkdir /output && cp ./build/libs/fernflower.jar /output | ||
|
|
||
| FROM registry.access.redhat.com/ubi9/ubi-minimal AS index-download | ||
| RUN microdnf install -y wget zip && microdnf clean all && rm -rf /var/cache/dnf | ||
| WORKDIR /maven-index-data | ||
| #TODO: get latest release when we get to update them periodically | ||
| RUN wget --quiet https://github.com/konveyor/maven-search-index/releases/download/v0.0.1/maven-index-data-v0.0.1.zip -O maven-index-data.zip && unzip maven-index-data.zip && rm maven-index-data.zip | ||
|
|
||
| FROM registry.access.redhat.com/ubi9/ubi-minimal | ||
| # Java 1.8 is required for backwards compatibility with older versions of Gradle | ||
| RUN microdnf install -y python39 java-1.8.0-openjdk-devel java-21-openjdk-devel tar gzip zip --nodocs --setopt=install_weak_deps=0 && microdnf clean all && rm -rf /var/cache/dnf | ||
| ENV JAVA_HOME /usr/lib/jvm/java-21-openjdk | ||
| # Specify Java 1.8 home for usage with gradle wrappers | ||
| ENV JAVA8_HOME /usr/lib/jvm/java-1.8.0-openjdk | ||
| RUN curl -fsSL -o /tmp/apache-maven.tar.gz https://dlcdn.apache.org/maven/maven-3/3.9.11/binaries/apache-maven-3.9.11-bin.tar.gz && \ | ||
| tar -xzf /tmp/apache-maven.tar.gz -C /usr/local/ && \ | ||
| ln -s /usr/local/apache-maven-3.9.11/bin/mvn /usr/bin/mvn && \ | ||
| rm /tmp/apache-maven.tar.gz | ||
| ENV M2_HOME /usr/local/apache-maven-3.9.11 | ||
|
|
||
| # Copy "download sources" gradle task. This is needed to download project sources. | ||
| RUN mkdir /root/.gradle | ||
| COPY ./gradle/build.gradle /usr/local/etc/task.gradle | ||
| COPY ./gradle/build-v9.gradle /usr/local/etc/task-v9.gradle | ||
|
|
||
| COPY --from=jdtls-download /jdtls /jdtls/ | ||
| COPY --from=fernflower /output/fernflower.jar /bin/fernflower.jar | ||
| COPY --from=maven-index /maven.default.index /usr/local/etc/maven.default.index | ||
| COPY --from=index-download /maven-index-data/central.archive-metadata.txt /usr/local/etc/maven-index.txt | ||
| COPY --from=index-download /maven-index-data/central.archive-metadata.idx /usr/local/etc/maven-index.idx | ||
| RUN microdnf install -y golang | ||
|
|
||
| RUN ln -sf /root/.m2 /.m2 && chgrp -R 0 /root && chmod -R g=u /root | ||
| COPY java-analyzer-bundle.core/target/java-analyzer-bundle.core-1.0.0-SNAPSHOT.jar /jdtls/plugins/ | ||
| CMD [ "/jdtls/bin/jdtls" ] |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,141 @@ | ||
| # Makefile for Java Analyzer Bundle | ||
| # Replicates GitHub Actions CI/CD pipeline for local verification | ||
|
|
||
| .PHONY: help all ci clean clean-containers clean-go phase1 phase2 unit-tests build-container run-integration-tests | ||
|
|
||
| # Detect container runtime (prefer Podman, fallback to Docker) | ||
| CONTAINER_RUNTIME := $(shell command -v podman 2>/dev/null || command -v docker 2>/dev/null) | ||
| ifeq ($(CONTAINER_RUNTIME),) | ||
| $(error Neither podman nor docker is installed) | ||
| endif | ||
|
|
||
| # Set volume flags based on container runtime | ||
| ifeq ($(findstring podman,$(CONTAINER_RUNTIME)),podman) | ||
| VOLUME_FLAGS := :Z | ||
| else | ||
| VOLUME_FLAGS := | ||
| endif | ||
|
|
||
| # Variables | ||
| IMAGE_NAME := jdtls-analyzer:test | ||
| REPO_ROOT := $(shell pwd) | ||
| GO_MODULE := java-analyzer-bundle.test/integration | ||
|
|
||
| # Default target | ||
| help: | ||
| @echo "======================================================================" | ||
| @echo "Java Analyzer Bundle - CI/CD Verification Makefile" | ||
| @echo "======================================================================" | ||
| @echo "" | ||
| @echo "Available targets:" | ||
| @echo "" | ||
| @echo " make ci - Run complete CI/CD pipeline (Phase 1 + 2)" | ||
| @echo " make phase1 - Run Phase 1: Unit tests only" | ||
| @echo " make phase2 - Run Phase 2: Integration tests only" | ||
| @echo "" | ||
| @echo "Phase 1 targets:" | ||
| @echo " make unit-tests - Run Maven unit tests" | ||
| @echo "" | ||
| @echo "Phase 2 targets:" | ||
| @echo " make build-container - Build JDT.LS container image" | ||
| @echo " make run-integration-tests - Run integration tests in container" | ||
| @echo "" | ||
| @echo "Utility targets:" | ||
| @echo " make clean - Clean all build artifacts" | ||
| @echo " make clean-containers - Remove container images" | ||
| @echo " make clean-go - Clean Go build artifacts" | ||
| @echo "" | ||
| @echo "Container runtime: $(CONTAINER_RUNTIME)" | ||
| @echo "======================================================================" | ||
|
|
||
| # Run complete CI/CD pipeline | ||
| ci: phase1 phase2 | ||
| @echo "" | ||
| @echo "======================================================================" | ||
| @echo "✓ Complete CI/CD Pipeline Succeeded!" | ||
| @echo "======================================================================" | ||
|
|
||
| # Alias for consistency | ||
| all: ci | ||
|
|
||
| # Phase 1: Unit Tests | ||
| phase1: unit-tests | ||
| @echo "" | ||
| @echo "======================================================================" | ||
| @echo "✓ Phase 1 Complete: Unit tests passed" | ||
| @echo "======================================================================" | ||
|
|
||
| # Phase 2: Integration Tests | ||
| phase2: build-container run-integration-tests | ||
| @echo "" | ||
| @echo "======================================================================" | ||
| @echo "✓ Phase 2 Complete: Integration tests passed" | ||
| @echo "======================================================================" | ||
|
|
||
| # Phase 1 Targets | ||
| unit-tests: | ||
| @echo "======================================================================" | ||
| @echo "Phase 1: Running Unit Tests" | ||
| @echo "======================================================================" | ||
| @echo "" | ||
| mvn clean integration-test | ||
|
|
||
| # Phase 2 Targets | ||
| build-container: | ||
| @echo "" | ||
| @echo "======================================================================" | ||
| @echo "Phase 2: Building JDT.LS Container Image" | ||
| @echo "======================================================================" | ||
| @echo "" | ||
| @echo "Using container runtime: $(CONTAINER_RUNTIME)" | ||
| @echo "" | ||
| $(CONTAINER_RUNTIME) build -t $(IMAGE_NAME) -f Dockerfile.test . | ||
| @echo "" | ||
| @echo "✓ Container image built: $(IMAGE_NAME)" | ||
|
|
||
| run-integration-tests: | ||
| @echo "" | ||
| @echo "======================================================================" | ||
| @echo "Phase 2: Running Integration Tests in Container" | ||
| @echo "======================================================================" | ||
| @echo "" | ||
| @echo "Installing Go and running tests inside container..." | ||
| $(CONTAINER_RUNTIME) run --rm \ | ||
| -v $(REPO_ROOT)/java-analyzer-bundle.test:/tests$(VOLUME_FLAGS) \ | ||
| -e WORKSPACE_DIR=/tests/projects \ | ||
| -e JDTLS_PATH=/jdtls \ | ||
| --workdir /tests/integration \ | ||
| --entrypoint /bin/sh \ | ||
| $(IMAGE_NAME) \ | ||
| -c "microdnf install -y golang && go mod download && go test -v" | ||
| @echo "" | ||
| @echo "✓ Integration tests passed" | ||
|
|
||
| # Clean targets | ||
| clean: clean-go | ||
| @echo "======================================================================" | ||
| @echo "Cleaning Build Artifacts" | ||
| @echo "======================================================================" | ||
| mvn clean | ||
| @echo "" | ||
| @echo "✓ Maven artifacts cleaned" | ||
|
|
||
| clean-containers: | ||
| @echo "======================================================================" | ||
| @echo "Removing Container Images" | ||
| @echo "======================================================================" | ||
| -$(CONTAINER_RUNTIME) rmi $(IMAGE_NAME) 2>/dev/null || true | ||
| @echo "" | ||
| @echo "✓ Container images removed" | ||
|
|
||
| clean-go: | ||
| @echo "Cleaning Go build artifacts..." | ||
| cd $(GO_MODULE) && go clean -testcache | ||
| @echo "✓ Go artifacts cleaned" | ||
|
|
||
| # Development targets | ||
| .PHONY: test test-phase1 test-phase2 verify | ||
| test: ci | ||
| test-phase1: phase1 | ||
| test-phase2: phase2 | ||
| verify: ci |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Critical: Dockerfile inconsistency between CI and local environments.
Line 60 builds from the default
Dockerfile, but the local test script (run_local.shline 32) and Makefile (line 92) explicitly useDockerfile.test. This environment drift will cause CI and local test runs to use different container configurations, potentially masking issues.Apply this diff to align with local scripts:
- name: Build JDT.LS container image with Podman run: | - podman build -t jdtls-analyzer:test . + podman build -t jdtls-analyzer:test -f Dockerfile.test .📝 Committable suggestion
🤖 Prompt for AI Agents