Skip to content

Commit

Permalink
fix config tests
Browse files Browse the repository at this point in the history
  • Loading branch information
raphael-theriault-swi committed Dec 15, 2023
1 parent 93fde63 commit c06dcec
Showing 1 changed file with 14 additions and 14 deletions.
28 changes: 14 additions & 14 deletions packages/solarwinds-apm/test/config.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -29,8 +29,8 @@ describe("readConfig", () => {
process.env.SW_APM_SERVICE_KEY = "token:name"
})

it("returns proper defaults", () => {
const config = readConfig()
it("returns proper defaults", async () => {
const config = await readConfig()
const expected: ExtendedSwConfiguration = {
token: "token",
serviceName: "name",
Expand All @@ -56,40 +56,40 @@ describe("readConfig", () => {
expect(config).to.deep.include(expected)
})

it("parses booleans", () => {
it("parses booleans", async () => {
process.env.SW_APM_ENABLED = "0"

const config = readConfig()
const config = await readConfig()
expect(config).to.include({ enabled: false })
})

it("parses tracing mode", () => {
it("parses tracing mode", async () => {
process.env.SW_APM_TRACING_MODE = "enabled"

const config = readConfig()
const config = await readConfig()
expect(config).to.include({ tracingMode: true })
})

it("parses trusted path", () => {
it("parses trusted path", async () => {
process.env.SW_APM_TRUSTEDPATH = "package.json"

const config = readConfig()
const config = await readConfig()
expect(config.certificate).to.include("solarwinds-apm")
})

it("parses transaction settings", () => {
it("parses transaction settings", async () => {
process.env.SW_APM_CONFIG_FILE = "test/test.config.js"

const config = readConfig()
const config = await readConfig()
expect(config.transactionSettings).not.to.be.undefined
expect(config.transactionSettings).to.have.length(3)
})

it("parses dev env", () => {
it("parses dev env", async () => {
process.env.SW_APM_DEV_OTLP_TRACES = "true"
process.env.SW_APM_DEV_SW_METRICS = "0"

const config = readConfig()
const config = await readConfig()
expect(config.dev.otlpTraces).to.be.true
expect(config.dev.swMetrics).to.be.false
})
Expand All @@ -112,10 +112,10 @@ describe("readConfig", () => {
expect(readConfig).to.throw()
})

it("uses the right defaults for AppOptics", () => {
it("uses the right defaults for AppOptics", async () => {
process.env.SW_APM_COLLECTOR = "collector.appoptics.com"

const config = readConfig()
const config = await readConfig()
expect(config).to.include({
metricFormat: 1,
certificate: aoCert,
Expand Down

0 comments on commit c06dcec

Please sign in to comment.