Skip to content
Draft
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
78 changes: 0 additions & 78 deletions .github/workflows/system-tests-backend.yml

This file was deleted.

16 changes: 1 addition & 15 deletions Makefile
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
.PHONY: all clean compile javadocs dryRelease update checkFormat api assembleUiTestRelease assembleUiTestCriticalRelease runUiTestCritical setupPython systemTest systemTestInteractive check preMerge publish
.PHONY: all clean compile javadocs dryRelease update checkFormat api assembleUiTestRelease assembleUiTestCriticalRelease runUiTestCritical check preMerge publish

all: stop clean javadocs compile
assembleUiTests: assembleUiTestRelease
Expand Down Expand Up @@ -46,20 +46,6 @@ assembleUiTestCriticalRelease:
runUiTestCritical:
./scripts/test-ui-critical.sh

# Create the Python virtual environment for system tests, and install the necessary dependencies
setupPython:
@test -d .venv || python3 -m venv .venv
.venv/bin/pip install --upgrade pip
.venv/bin/pip install -r requirements.txt

# Run system tests for sample applications
systemTest: setupPython
.venv/bin/python test/system-test-runner.py test --all

# Run system tests with interactive module selection
systemTestInteractive: setupPython
.venv/bin/python test/system-test-runner.py test --interactive

# Run tests and lint
check:
./gradlew check
5 changes: 0 additions & 5 deletions requirements.txt

This file was deleted.

Original file line number Diff line number Diff line change
@@ -0,0 +1,68 @@
package io.sentry.logback

import ch.qos.logback.classic.LoggerContext
import ch.qos.logback.classic.joran.JoranConfigurator
import com.google.common.truth.Truth.assertThat
import io.sentry.Sentry
import io.sentry.SentryLevel
import io.sentry.test.MockSentryServer
import io.sentry.test.event
import io.sentry.test.hasFlag
import io.sentry.test.logs
import kotlin.test.AfterTest
import kotlin.test.Test
import org.slf4j.MDC

class SentryAppenderIntegrationTest {
private val server = MockSentryServer()
private val loggerContext = LoggerContext()

@AfterTest
fun teardown() {
loggerContext.stop()
Sentry.close()
server.close()
MDC.clear()
}

@Test
fun `appender configured from XML sends events, breadcrumbs and logs`() {
loggerContext.putProperty("dsn", server.dsn)
JoranConfigurator()
.apply { context = loggerContext }
.doConfigure(javaClass.getResource("/sentry-appender-integration-test.xml"))
val logger = loggerContext.getLogger(SentryAppenderIntegrationTest::class.java)

logger.debug("Hello Sentry!")
MDC.put("userId", "user-1")
Sentry.setAttribute("user.type", "admin")
Sentry.setAttribute("feature.version", 2)
Sentry.setAttribute("debug.enabled", true)
Sentry.addFeatureFlag("my-feature-flag", true)
logger.warn("important warning")
logger.info("User has made a purchase of product: {}", 445)
logger.error("Something went wrong", RuntimeException("Invalid productId=445"))
Sentry.flush(5000)

val warning = server.awaitEnvelope { it.event()?.level == SentryLevel.WARNING }.event()!!
assertThat(warning.message!!.message).isEqualTo("important warning")
assertThat(warning.tags).containsEntry("userId", "user-1")
assertThat(warning.hasFlag("my-feature-flag", true)).isTrue()

val error = server.awaitEnvelope { it.event()?.level == SentryLevel.ERROR }.event()!!
assertThat(error.message!!.formatted).isEqualTo("Something went wrong")
assertThat(error.exceptions!!.map { it.type to it.value })
.contains("RuntimeException" to "Invalid productId=445")
assertThat(error.breadcrumbs!!.map { it.message to it.level })
.containsAtLeast(
"Hello Sentry!" to SentryLevel.DEBUG,
"User has made a purchase of product: 445" to SentryLevel.INFO,
)

val logs = server.awaitEnvelope { it.logs() != null }.logs()!!
assertThat(logs.items.map { it.body }).contains("User has made a purchase of product: 445")
val failureLog = logs.items.single { it.body == "Something went wrong" }
assertThat(failureLog.attributes!!.mapValues { it.value.value })
.containsAtLeast("user.type", "admin", "feature.version", 2, "debug.enabled", true)
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
<configuration>
<appender name="sentry" class="io.sentry.logback.SentryAppender">
<options>
<dsn>${dsn}</dsn>
<contextTag>userId</contextTag>
<logs>
<enabled>true</enabled>
</logs>
</options>
<minimumEventLevel>WARN</minimumEventLevel>
<minimumBreadcrumbLevel>DEBUG</minimumBreadcrumbLevel>
<minimumLevel>INFO</minimumLevel>
</appender>

<root level="debug">
<appender-ref ref="sentry"/>
</root>
</configuration>
36 changes: 0 additions & 36 deletions sentry-samples/sentry-samples-logback/build.gradle.kts
Original file line number Diff line number Diff line change
@@ -1,32 +1,15 @@
import org.jetbrains.kotlin.gradle.tasks.KotlinCompile

plugins {
java
application
alias(libs.plugins.kotlin.jvm)
alias(libs.plugins.gradle.versions)
alias(libs.plugins.shadow)
id("io.sentry.systemtest")
}

application { mainClass.set("io.sentry.samples.logback.Main") }

tasks.withType<KotlinCompile>().configureEach {
kotlin {
compilerOptions.freeCompilerArgs = listOf("-Xjsr305=strict")
}
}

dependencies {
implementation(projects.sentryLogback)
implementation(libs.logback.classic)

testImplementation(kotlin(Config.kotlinStdLib))
testImplementation(projects.sentry)
testImplementation(projects.sentrySystemTestSupport)
testImplementation(libs.kotlin.test.junit)
testImplementation(libs.slf4j.api)
testImplementation(libs.slf4j.jdk14)
}

// Configure the Shadow JAR (executable JAR with all dependencies)
Expand All @@ -44,22 +27,3 @@ tasks.jar {

// Fix the startScripts task dependency
tasks.startScripts { dependsOn(tasks.shadowJar) }

tasks.register<Test>("systemTest").configure {
group = "verification"
description = "Runs the System tests"

val test = project.extensions.getByType<SourceSetContainer>()["test"]
testClassesDirs = test.output.classesDirs
classpath = test.runtimeClasspath

maxParallelForks = 1

filter { includeTestsMatching("io.sentry.systemtest*") }
}

tasks.named("test").configure {
require(this is Test)

filter { excludeTestsMatching("io.sentry.systemtest.*") }
}

This file was deleted.

This file was deleted.

Loading
Loading