Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 12 additions & 2 deletions .github/workflows/build-health.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,15 @@ jobs:
name: Build Report
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@eef61447b9ff4aafe5dcd4e0bbf5d482be7e7871 # v4
- name: Checkout
uses: actions/checkout@v4
with:
path: main
- name: Checkout
uses: actions/checkout@v4
with:
repository: failgood/failgood
path: failgood
- uses: actions/setup-java@v4
with:
distribution: 'temurin'
Expand All @@ -27,12 +35,14 @@ jobs:
restore-keys: ${{ runner.os }}-gradle
- name: Build with Gradle
run: ./gradlew buildHealth
working-directory:
main
- name: Comment PR
uses: actions/github-script@v7
with:
github-token: ${{secrets.GITHUB_TOKEN}}
script: |
const path = 'build/reports/dependency-analysis/build-health-report.txt'
const path = 'main/build/reports/dependency-analysis/build-health-report.txt'
const fs = require('fs')
if (!fs.existsSync(path)) {
console.error('Generated file not found!');
Expand Down
11 changes: 10 additions & 1 deletion .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,15 @@ jobs:
matrix:
java: [ 17,21 ]
steps:
- uses: actions/checkout@v4
- name: Checkout
uses: actions/checkout@v4
with:
path: main
- name: Checkout
uses: actions/checkout@v4
with:
repository: failgood/failgood
path: failgood
- uses: actions/setup-java@v4
with:
distribution: 'temurin'
Expand All @@ -31,6 +39,7 @@ jobs:
env:
CI: true
run: ./gradlew build
working-directory: main
- uses: codecov/codecov-action@v4
with:
files: core/build/reports/kover/report.xml,rest/build/reports/kover/report.xml
Expand Down
12 changes: 11 additions & 1 deletion .github/workflows/pitest.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,15 @@ jobs:
name: pitest on jdk 17
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Checkout
uses: actions/checkout@v4
with:
path: main
- name: Checkout
uses: actions/checkout@v4
with:
repository: failgood/failgood
path: failgood
- uses: actions/setup-java@v4
with:
distribution: 'temurin'
Expand All @@ -29,6 +37,8 @@ jobs:
CI: true
PITEST_THREADS: 2
run: ./gradlew pitest
working-directory:
main
- name: upload artifacts
uses: actions/upload-artifact@v4
if: always()
Expand Down
2 changes: 1 addition & 1 deletion buildSrc/src/main/kotlin/restaurant/versions/Versions.kt
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
package restaurant.versions

const val failgoodVersion = "0.9.1"
const val failgoodVersion = "0.9.2"
const val striktVersion = "0.34.1"
const val kotlinVersion = "2.1.10"
const val jacksonVersion = "2.18.2"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -105,6 +105,7 @@ internal fun buildUndertow(
throw RestaurantException(
"could not start restaurant after trying $TOTAL_TRIES times." +
" ports tried: $triedPorts")
Thread.sleep(100)
continue
}
throw e
Expand Down
4 changes: 2 additions & 2 deletions core/src/test/kotlin/restaurant/CoroutinesTest.kt
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ package restaurant

import failgood.Ignored
import failgood.Test
import failgood.testsAbout
import failgood.testCollection
import java.net.http.HttpTimeoutException
import kotlin.time.Duration.Companion.milliseconds
import kotlinx.coroutines.delay
Expand All @@ -13,7 +13,7 @@ import strikt.assertions.isFalse
@Test
class CoroutinesTest {
val context =
testsAbout("coroutine handling") {
testCollection("coroutine handling") {
it(
"cancels coroutine scope when the client disconnects",
ignored =
Expand Down
4 changes: 2 additions & 2 deletions core/src/test/kotlin/restaurant/RequestTest.kt
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
package restaurant

import failgood.Test
import failgood.testsAbout
import failgood.testCollection
import kotlin.test.assertEquals
import strikt.api.expectThat
import strikt.assertions.containsExactly
Expand All @@ -12,7 +12,7 @@ import strikt.assertions.isNotNull
@Test
class RequestTest {
val context =
testsAbout(Request::class) {
testCollection(Request::class) {
describe("get requests") {
lateinit var req: Request
val restaurant =
Expand Down
4 changes: 2 additions & 2 deletions core/src/test/kotlin/restaurant/RestaurantTest.kt
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
package restaurant

import failgood.Test
import failgood.testsAbout
import failgood.testCollection
import java.nio.ByteBuffer
import kotlin.test.assertNotNull
import kotlinx.coroutines.CompletableDeferred
Expand All @@ -15,7 +15,7 @@ import strikt.assertions.*
@Test
class RestaurantTest {
val context =
testsAbout(Restaurant::class) {
testCollection(Restaurant::class) {
describe("routing") {
val restaurant =
autoClose(
Expand Down
4 changes: 2 additions & 2 deletions core/src/test/kotlin/restaurant/TestabilityTest.kt
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
package restaurant

import failgood.Test
import failgood.testsAbout
import failgood.testCollection
import java.nio.ByteBuffer
import restaurant.test.MockRequest
import strikt.api.expectThat
Expand All @@ -18,7 +18,7 @@ class Reverser : SuspendingHandler {
@Test
class TestabilityTest {
val context =
testsAbout("testability") {
testCollection("testability") {
test("handlers can be invoked with a MockRequest") {
val handler = Reverser()
expectThat(
Expand Down
4 changes: 2 additions & 2 deletions core/src/test/kotlin/restaurant/WrappersTest.kt
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
package restaurant

import failgood.Test
import failgood.testsAbout
import failgood.testCollection
import java.nio.ByteBuffer
import strikt.api.expectThat
import strikt.assertions.containsExactly
Expand All @@ -10,7 +10,7 @@ import strikt.assertions.isEqualTo
@Test
class WrappersTest {
val context =
testsAbout("Wrapper Support") {
testCollection("Wrapper Support") {
val events = mutableListOf<String>()
val inner = Wrapper { wrapped ->
SuspendingHandler { request, requestContext ->
Expand Down
4 changes: 2 additions & 2 deletions core/src/test/kotlin/restaurant/client/HttpClientTest.kt
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
package restaurant.client

import failgood.Test
import failgood.testsAbout
import failgood.testCollection
import kotlinx.coroutines.flow.toList
import restaurant.*
import strikt.api.expectThat
Expand All @@ -13,7 +13,7 @@ import strikt.assertions.isNotNull
@Test
class HttpClientTest {
val context =
testsAbout(Java11HttpClient::class) {
testCollection(Java11HttpClient::class) {
val restaurant =
autoClose(
Restaurant {
Expand Down
4 changes: 2 additions & 2 deletions core/src/test/kotlin/restaurant/internal/RoutesTest.kt
Original file line number Diff line number Diff line change
Expand Up @@ -2,15 +2,15 @@ package restaurant.internal

import failgood.Test
import failgood.mock.mock
import failgood.testsAbout
import failgood.testCollection
import restaurant.*
import strikt.api.expectThat
import strikt.assertions.containsExactly

@Test
class RoutesTest {
val context =
testsAbout("Routes") {
testCollection("Routes") {
test("creates routes for wrapped handlers") {
val inner = Wrapper { SuspendingHandler { _, _ -> response(200) } }
val outer = Wrapper { SuspendingHandler { _, _ -> response(200) } }
Expand Down
Original file line number Diff line number Diff line change
@@ -1,15 +1,15 @@
package restaurant.internal.undertow

import failgood.Test
import failgood.tests
import failgood.testCollection
import kotlin.test.assertEquals
import kotlin.test.assertNotNull
import restaurant.findFreePort
import restaurant.response

@Test
class UndertowTest {
val test = tests {
val test = testCollection {
it("can create an undertow server on a random port") {
autoClose(buildUndertow(emptyList(), { _, _ -> response(200) }, null, "localhost")) {
it.undertow.stop()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ package restaurant.internal

import com.fasterxml.jackson.module.kotlin.jacksonObjectMapper
import failgood.Test
import failgood.testsAbout
import failgood.testCollection
import java.util.*
import kotlinx.coroutines.runBlocking
import restaurant.JacksonMapper
Expand All @@ -20,7 +20,7 @@ import strikt.assertions.single
@Test
class RoutesAdderFunctionalTest {
val context =
testsAbout(RoutesAdder::class) {
testCollection(RoutesAdder::class) {
val requestContext = MutableRequestContext()
val routesAdder = RoutesAdder(JacksonMapper(jacksonObjectMapper()))
listOf(
Expand Down
4 changes: 2 additions & 2 deletions jackson/src/test/kotlin/restaurant/rest/RestRestaurantTest.kt
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ package restaurant.rest

import failgood.Ignored
import failgood.Test
import failgood.testsAbout
import failgood.testCollection
import restaurant.*
import restaurant.internal.HobbyService
import restaurant.internal.UserService
Expand All @@ -18,7 +18,7 @@ fun restaurant(serviceMapping: RoutingDSL.() -> Unit) =
@Test
class RestRestaurantTest {
val context =
testsAbout(Restaurant::class) {
testCollection(Restaurant::class) {
describe("rest services") {
it("empty responses return 204") {
class EmptyReplyService : RestService {
Expand Down
4 changes: 2 additions & 2 deletions jackson/src/test/kotlin/restaurant/rest/SealedClassTest.kt
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ package restaurant.rest
import com.fasterxml.jackson.module.kotlin.jacksonObjectMapper
import com.fasterxml.jackson.module.kotlin.readValue
import failgood.Test
import failgood.testsAbout
import failgood.testCollection
import restaurant.sendRequest
import strikt.api.expectThat
import strikt.assertions.isEqualTo
Expand All @@ -19,7 +19,7 @@ class LoginFailed(val message: String) : LoginResult()
@Test
class SealedClassTest {
val context =
testsAbout("Different return types with sealed classes") {
testCollection("Different return types with sealed classes") {
it("is supported") {
class SealService : RestService {
fun show(id: Long): LoginResult {
Expand Down
4 changes: 2 additions & 2 deletions jackson/src/test/kotlin/restaurant/rest/StreamingExample.kt
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
package restaurant.rest

import failgood.Test
import failgood.testsAbout
import failgood.testCollection
import kotlinx.coroutines.delay
import kotlinx.coroutines.flow.Flow
import kotlinx.coroutines.flow.flow
Expand All @@ -20,7 +20,7 @@ import strikt.assertions.isEqualTo
class StreamingExample {
@Suppress("unused")
val tests =
testsAbout("streaming via kotlin flows") {
testCollection("streaming via kotlin flows") {
class StreamService : RestService {
@Suppress("unused")
fun index(): Flow<User> {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
package restaurant.rest.internal

import failgood.Test
import failgood.testsAbout
import failgood.testCollection
import restaurant.MutableRequestContext
import restaurant.RequestContext
import restaurant.rest.RestService
Expand All @@ -14,7 +14,7 @@ import strikt.assertions.message
@Test
class RestFunctionTest {
val context =
testsAbout(RestFunction::class) {
testCollection(RestFunction::class) {
data class Body(val field: String)

val requestContext = MutableRequestContext()
Expand Down
4 changes: 2 additions & 2 deletions jwt/src/test/kotlin/restaurant/JWTTest.kt
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import com.auth0.jwt.JWT
import com.auth0.jwt.algorithms.Algorithm
import com.auth0.jwt.interfaces.JWTVerifier
import failgood.Test
import failgood.testsAbout
import failgood.testCollection
import strikt.api.expectThat
import strikt.assertions.isEqualTo

Expand Down Expand Up @@ -34,7 +34,7 @@ class JWTWelcomeHandler : SuspendingHandler {
@Test
class JWTTest {
val context =
testsAbout("JWT Support") {
testCollection("JWT Support") {
val restaurant =
autoClose(
Restaurant {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ package restaurant.exp.rest2

import failgood.Ignored
import failgood.Test
import failgood.testsAbout
import failgood.testCollection
import kotlinx.coroutines.delay
import kotlinx.coroutines.flow.Flow
import kotlinx.coroutines.flow.flowOf
Expand All @@ -28,7 +28,7 @@ fun restaurant(serviceMapping: RoutingDSL.() -> Unit) = Restaurant(serviceMappin
@Test
object RestRestaurantTest {
val context =
testsAbout(Restaurant::class) {
testCollection(Restaurant::class) {
describe("rest services") {
describe("rest routes") {
val r =
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ package restaurant.rest.kotlinxser

import failgood.Ignored
import failgood.Test
import failgood.testsAbout
import failgood.testCollection
import kotlinx.serialization.Serializable
import kotlinx.serialization.json.Json

Expand All @@ -11,7 +11,7 @@ import kotlinx.serialization.json.Json
@Test
object KotlinxSerializationJsonMapperTest {
val context =
testsAbout(
testCollection(
KotlinxSerializationMapper::class,
ignored =
Ignored.Because(
Expand Down
Loading
Loading