Skip to content
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
16 changes: 12 additions & 4 deletions .github/workflows/linux.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
name: Linux browsers
name: Influx test on Linux
on:
push:
branches:
Expand All @@ -15,8 +15,13 @@ jobs:
uses: actions/setup-node@v4
with:
node-version: '22.x'
- name: Install dependencies
run: npm install ci
- name: Install sitespeed.io
run: npm install sitespeed.io -g
run: |
git clone https://github.com/sitespeedio/sitespeed.io.git
cd sitespeed.io
npm install
- name: Install Chrome
run: |
wget -q -O - https://dl-ssl.google.com/linux/linux_signing_key.pub | sudo apt-key add -
Expand All @@ -34,7 +39,10 @@ jobs:
- name: Browser versions
run: |
google-chrome --version
- name: Info
run: |
ls -la
- name: Run test with Influx 1.8
run: sitespeed.io https://www.sitespeed.io -n 1 --influxdb.host 127.0.0.1 --xvfb --resultBaseUrl https://result.sitespeed.io --influxdb.annotationScreenshot=true
run: cd sitespeed.io && bin/sitespeed.js https://www.sitespeed.io -n 1 --influxdb.host 127.0.0.1 --xvfb --resultBaseUrl https://result.sitespeed.io --influxdb.annotationScreenshot=true --plugins.add ../../../lib/index.js
- name: Run test with Influx 2.6.1
run: sitespeed.io https://www.sitespeed.io -n 1 --influxdb.host 127.0.0.1 --influxdb.port 8087 --influxdb.version 2 --influxdb.organisation sitespeed --influxdb.token sitespeed --xvfb --resultBaseUrl https://result.sitespeed.io --influxdb.annotationScreenshot=true
run: cd sitespeed.io && bin/sitespeed.js https://www.sitespeed.io -n 1 --influxdb.host 127.0.0.1 --influxdb.port 8087 --influxdb.version 2 --influxdb.organisation sitespeed --influxdb.token sitespeed --xvfb --resultBaseUrl https://result.sitespeed.io --influxdb.annotationScreenshot=true --plugins.add ../../../lib/index.js
6 changes: 6 additions & 0 deletions lib/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,10 @@ import { sendV1 } from './send-annotation.js';
import { sendV2 } from './send-annotationV2.js';
import { InfluxDBDataGenerator as DataGenerator } from './data-generator.js';
import { throwIfMissing, isEmpty } from './util.js';
import { getInfluxdbOptions } from './cli.js';

const log = getLogger('sitespeedio.plugin.influxdb');

export default class InfluxDBPlugin extends SitespeedioPlugin {
constructor(options, context, queue) {
super({ name: 'influxdb', options, context, queue });
Expand Down Expand Up @@ -174,3 +176,7 @@ export default class InfluxDBPlugin extends SitespeedioPlugin {
}
}
}

export function getCliOptions() {
return getInfluxdbOptions();
}
5 changes: 4 additions & 1 deletion lib/util.js
Original file line number Diff line number Diff line change
Expand Up @@ -126,6 +126,9 @@ export function getAnnotationMessage(
}

export function throwIfMissing(options, keys, namespace) {
if (!options) {
throw new Error('Missing influxdb namespace from configuration');
}
let missingKeys = keys.filter(key => !options[key]);
if (missingKeys.length > 0) {
throw new Error(
Expand All @@ -135,7 +138,7 @@ export function throwIfMissing(options, keys, namespace) {
namespace
)
);
}
}
}

export function isEmpty(value) {
Expand Down