Skip to content

Commit

Permalink
Move crosstests to unit tests (#65)
Browse files Browse the repository at this point in the history
Translating previous tests into vanilla JUnit and removing a lot of
duplication code for the javalite suite.
  • Loading branch information
buildbreaker authored Aug 10, 2023
1 parent f6aee84 commit e78b96b
Show file tree
Hide file tree
Showing 15 changed files with 232 additions and 1,272 deletions.
12 changes: 12 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,12 @@ jobs:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: bufbuild/[email protected]
with:
github_token: ${{ github.token }}
- uses: arduino/setup-protoc@v1
with:
repo-token: ${{ secrets.GITHUB_TOKEN }}
- uses: docker-practice/actions-setup-docker@master
- uses: actions/setup-go@v4
- uses: bufbuild/[email protected]
Expand Down Expand Up @@ -82,6 +88,12 @@ jobs:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: bufbuild/[email protected]
with:
github_token: ${{ github.token }}
- uses: arduino/setup-protoc@v1
with:
repo-token: ${{ secrets.GITHUB_TOKEN }}
- name: Run tests
run: make test
lint:
Expand Down
14 changes: 4 additions & 10 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ $(BIN)/license-headers: Makefile

.PHONY: build
build: generate ## Build the entire project.
./gradlew build
./gradlew build -x test

.PHONY: buildplugin
buildplugin: ## Build the connect-kotlin protoc plugin.
Expand Down Expand Up @@ -50,17 +50,11 @@ crosstestserverstop: ## Stop the server for cross tests.
-docker container stop serverconnect servergrpc

.PHONY: crosstestsrun
crosstestsrun: crosstestsrunjava crosstestsrunjavalite ## Run the cross tests.
crosstestsrun: crosstestsrunjava ## Run the cross tests.

.PHONY: crosstestsrunjava
crosstestsrunjava: ## Run the cross tests for protoc-gen-java integration.
./gradlew crosstests:google-java:jar
java -jar ./crosstests/google-java/build/libs/google-java-crosstests.jar

.PHONY: crosstestsrunjavalite
crosstestsrunjavalite: ## Run the cross tests for protoc-gen-javalite integration.
./gradlew crosstests:google-javalite:jar
java -jar ./crosstests/google-javalite/build/libs/google-javalite-crosstests.jar
./gradlew crosstest:google-java:test

.PHONY: generate
generate: buildplugin generatecrosstests generateexamples ## Generate proto files for the entire project.
Expand Down Expand Up @@ -113,5 +107,5 @@ releaselocal: ## Release artifacts to local maven repository.
./gradlew --info publishToMavenLocal

.PHONY: test
test: ## Run tests for the library.
test: generate ## Run tests for the library.
./gradlew library:test
24 changes: 7 additions & 17 deletions crosstests/google-java/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -12,20 +12,6 @@ tasks {
freeCompilerArgs += "-Xopt-in=kotlin.RequiresOptIn"
}
}
jar {
manifest {
attributes(mapOf("Main-Class" to "build.buf.connect.crosstest.Main"))
}
duplicatesStrategy = DuplicatesStrategy.INCLUDE
// This line of code recursively collects and copies all of a project's files
// and adds them to the JAR itself. One can extend this task, to skip certain
// files or particular types at will
val sourcesMain = sourceSets.main.get()
val contents = configurations.runtimeClasspath.get()
.map { if (it.isDirectory) it else zipTree(it) } +
sourcesMain.output
from(contents)
}
}

sourceSets {
Expand All @@ -35,14 +21,18 @@ sourceSets {
}

dependencies {
implementation(libs.okhttp.core)

implementation(libs.kotlin.coroutines.core)
implementation(libs.assertj)
implementation(libs.protobuf.kotlin)
implementation(project(":crosstests:common"))
implementation(project(":extensions:google-java"))

implementation(project(":okhttp"))

testImplementation(libs.okhttp.core)
testImplementation(libs.junit)
testImplementation(libs.assertj)
testImplementation(libs.mockito)
testImplementation(libs.kotlin.coroutines.core)
}

configure<SpotlessExtension> {
Expand Down

This file was deleted.

Loading

0 comments on commit e78b96b

Please sign in to comment.