Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

E2E tests: specify in.logs.betterstack.com ingesting host #135

Merged
merged 6 commits into from
Feb 25, 2025
Merged
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
25 changes: 19 additions & 6 deletions .github/workflows/end-to-end.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,9 @@ name: E2E Tests

on:
push:
branches:
- master
paths:
- .github/workflows/end-to-end.yml
- example-project/**
schedule:
- cron: "20 5 * * *"
workflow_dispatch:
Expand All @@ -14,6 +15,7 @@ jobs:

strategy:
matrix:
infrastructure: [legacy, cloud]
node-version: [16.x, 18.x, 20.x, 22.x]
dependencies: [install, update]
fail-fast: false
Expand All @@ -33,12 +35,17 @@ jobs:
working-directory: ./example-project

- name: Run example project with valid token
run: node index.js ${{ secrets.SOURCE_TOKEN }}
env:
INGESTING_HOST: ${{ matrix.infrastructure == 'cloud' && secrets.CLOUD_INGESTING_HOST || 'in.logs.betterstack.com' }}
SOURCE_TOKEN: ${{ matrix.infrastructure == 'cloud' && secrets.CLOUD_SOURCE_TOKEN || secrets.SOURCE_TOKEN }}
run: node index.js ${{ env.SOURCE_TOKEN }} ${{ env.INGESTING_HOST }}
working-directory: ./example-project

- name: Run example project with invalid token
env:
INGESTING_HOST: ${{ matrix.infrastructure == 'cloud' && secrets.CLOUD_INGESTING_HOST || 'in.logs.betterstack.com' }}
run: |
if node index.js INVALID_TOKEN; then
if node index.js INVALID_TOKEN ${{ env.INGESTING_HOST }}; then
echo "This should have failed but didn't"
exit 1
else
Expand All @@ -51,6 +58,7 @@ jobs:

strategy:
matrix:
infrastructure: [legacy, cloud]
bun-version: [latest, 1.0.0]
dependencies: [install, update]
fail-fast: false
Expand All @@ -68,12 +76,17 @@ jobs:
working-directory: ./example-project

- name: Run example project with valid token
run: bun run index.js ${{ secrets.SOURCE_TOKEN }}
env:
INGESTING_HOST: ${{ matrix.infrastructure == 'cloud' && secrets.CLOUD_INGESTING_HOST || 'in.logs.betterstack.com' }}
SOURCE_TOKEN: ${{ matrix.infrastructure == 'cloud' && secrets.CLOUD_SOURCE_TOKEN || secrets.SOURCE_TOKEN }}
run: bun run index.js ${{ env.SOURCE_TOKEN }} ${{ env.INGESTING_HOST }}
working-directory: ./example-project

- name: Run example project with invalid token
env:
INGESTING_HOST: ${{ matrix.infrastructure == 'cloud' && secrets.CLOUD_INGESTING_HOST || 'in.logs.betterstack.com' }}
run: |
if bun run index.js INVALID_TOKEN; then
if bun run index.js INVALID_TOKEN ${{ env.INGESTING_HOST }}; then
echo "This should have failed but didn't"
exit 1
else
Expand Down
2 changes: 1 addition & 1 deletion example-project/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ const { Node: Logtail } = require("@logtail/js");
// Create a logger from a Logtail class
const logger = new Logtail(process.argv[2], {
sendLogsToConsoleOutput: true,
endpoint: process.argv[3],
endpoint: `https://${process.argv[3]}`,
});

// Usage
Expand Down