Skip to content

Commit

Permalink
Adding dockerfile and integration test. (#94)
Browse files Browse the repository at this point in the history
* Adding dockerfile and integration test.

* Update templated_tests/java_gradle/Dockerfile

Co-authored-by: codiumai-pr-agent-pro[bot] <151058649+codiumai-pr-agent-pro[bot]@users.noreply.github.com>

* Cleaned up Dockerfile.

---------

Co-authored-by: codiumai-pr-agent-pro[bot] <151058649+codiumai-pr-agent-pro[bot]@users.noreply.github.com>
  • Loading branch information
EmbeddedDevops1 and qodo-merge-pro[bot] authored Jun 10, 2024
1 parent 56838d5 commit 94d9996
Show file tree
Hide file tree
Showing 2 changed files with 52 additions and 1 deletion.
39 changes: 39 additions & 0 deletions templated_tests/java_gradle/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
# Use an image with the required GLIBC version
FROM ubuntu:24.04 as builder

# Install Java, Python 3.12, and its dev dependencies
ARG DEBIAN_FRONTEND=noninteractive
RUN apt-get update && \
apt-get install -y \
wget \
unzip \
openjdk-11-jdk && \
apt-get clean && \
rm -rf /var/lib/apt/lists/*

# Install specific Gradle version
RUN wget https://services.gradle.org/distributions/gradle-7.2-bin.zip -P /tmp && \
unzip -d /opt/gradle /tmp/gradle-*.zip && \
ls /opt/gradle/gradle-* && \
echo "export GRADLE_HOME=/opt/gradle/gradle-7.2" >> /etc/profile.d/gradle.sh && \
echo "export PATH=\${GRADLE_HOME}/bin:\${PATH}" >> /etc/profile.d/gradle.sh && \
chmod +x /etc/profile.d/gradle.sh && \
. /etc/profile.d/gradle.sh

# Set the environment variable for all subsequent RUN commands
ENV PATH="/opt/gradle/gradle-7.2/bin:${PATH}"

# Set the working directory
WORKDIR /home/gradle/src

# Copy the Gradle configuration files into the Docker image
COPY build.gradle settings.gradle gradlew ./

RUN chmod +x ./gradlew

# Copy the source code into the Docker image
COPY src ./src
COPY gradle ./gradle

# Build the application
RUN gradle build --no-daemon
14 changes: 13 additions & 1 deletion tests_integration/test_all.sh
Original file line number Diff line number Diff line change
Expand Up @@ -56,12 +56,24 @@ sh tests_integration/test_with_docker.sh \
--model $MODEL

# Go Webservice Example
# Note: GPT 3.5 hasn't been powerful enough to generate quality tests that pass
sh tests_integration/test_with_docker.sh \
--dockerfile "templated_tests/go_webservice/Dockerfile" \
--source-file-path "app.go" \
--test-file-path "app_test.go" \
--test-command "go test -coverprofile=coverage.out && gocov convert coverage.out | gocov-xml > coverage.xml" \
--model $MODEL
--model "gpt-4o"

# Java Gradle example
# Note: GPT 3.5 hasn't been powerful enough to generate quality tests that pass
sh tests_integration/test_with_docker.sh \
--dockerfile "templated_tests/java_gradle/Dockerfile" \
--source-file-path "src/main/java/com/davidparry/cover/SimpleMathOperations.java" \
--test-file-path "src/test/groovy/com/davidparry/cover/SimpleMathOperationsSpec.groovy" \
--test-command "./gradlew clean test jacocoTestReport" \
--coverage-type "jacoco" \
--code-coverage-report-path "build/reports/jacoco/test/jacocoTestReport.csv" \
--model "gpt-4o"

# # Java Spring Calculator example
# sh tests_integration/test_with_docker.sh \
Expand Down

0 comments on commit 94d9996

Please sign in to comment.