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

Add functional and acceptance test harnesses and spl2 tests and bugfixes #102

Merged
merged 60 commits into from
Sep 8, 2023
Merged
Show file tree
Hide file tree
Changes from 52 commits
Commits
Show all changes
60 commits
Select commit Hold shift + click to select a range
0fa1f16
Fix issues with install code continuing after promises are resolved/r…
fantavlik Jul 25, 2023
3eca468
Add integration tests
fantavlik Jul 31, 2023
918edf4
Job dependency fix in actions
fantavlik Jul 31, 2023
5a15fd0
Restrict tsconfig to out
fantavlik Aug 17, 2023
db933b4
Fix integration test prereq
fantavlik Aug 17, 2023
96734c6
Fix windows command syntax
fantavlik Aug 17, 2023
1fc7a5b
Ordering of steps
fantavlik Aug 17, 2023
726632a
Fix linux test run
fantavlik Aug 17, 2023
7e818a4
bad arg
fantavlik Aug 17, 2023
d0a68cf
fixes
fantavlik Aug 17, 2023
be97718
fix test out location
fantavlik Aug 17, 2023
3c42b6a
It's working!!!
fantavlik Aug 18, 2023
8fcf2c0
Setup tests to run locally and with blank
fantavlik Aug 20, 2023
bf7e503
First meaningful test
fantavlik Aug 20, 2023
56d3e30
Tweak sleep value
fantavlik Aug 20, 2023
fd0664e
Push the limit on the sleep time
fantavlik Aug 20, 2023
d213fc1
Try a WSL bug fix
fantavlik Aug 21, 2023
0434fd3
add debug logs
fantavlik Aug 21, 2023
66a601f
more debug
fantavlik Aug 21, 2023
a46caff
more sleep
fantavlik Aug 21, 2023
e7e40fc
test SPL notebooks
fantavlik Aug 22, 2023
05e0007
simpler tests
fantavlik Aug 23, 2023
4ce9ab5
don't stop believing
fantavlik Aug 23, 2023
4fae6ab
refactor into functional and integration tests
fantavlik Aug 23, 2023
c303b2e
Finalize workflows
fantavlik Aug 23, 2023
a56a555
Fix launch and add meaningful deserialize test.
fantavlik Aug 23, 2023
ac37c2d
Finish serialize/deserialize tests.
fantavlik Aug 23, 2023
bc6eb27
Factor out context for easier testing and add installer test.
fantavlik Aug 23, 2023
d295c19
Accept TOS before running SPL2 install
fantavlik Aug 23, 2023
39a1e58
Fix bug where we are prompting user to accept terms even if they have…
fantavlik Aug 24, 2023
2f3addf
Add missing bind
fantavlik Aug 24, 2023
0a4354d
avoid tracking progress for now
fantavlik Aug 24, 2023
d48b7c8
Assert lsp and java paths exist
fantavlik Aug 24, 2023
512c76d
rename
fantavlik Aug 24, 2023
8b4be22
Intermittent progress bar updates
fantavlik Aug 24, 2023
acf54b6
interval not timeout
fantavlik Aug 24, 2023
0632df3
adjust timeouts
fantavlik Aug 24, 2023
e0cd6a2
Merge branch 'spl2-fixes' into spl2-tests
fantavlik Aug 24, 2023
15bf29b
I don't think this should be failing
fantavlik Aug 24, 2023
2831862
improve assert messaging
fantavlik Aug 24, 2023
4fad0e5
windows fix
fantavlik Aug 24, 2023
bc80bf4
test alternative path formation
fantavlik Aug 25, 2023
88c69ec
Add initializer test
fantavlik Aug 25, 2023
3648df2
Increase timeout
fantavlik Aug 25, 2023
5a7915f
Test backup code to linux/mac path not found during extraction
fantavlik Aug 25, 2023
f757197
test unix fix
fantavlik Aug 25, 2023
8c5fe08
fix hardoded ext issue and try windows and linux backup paths
fantavlik Aug 25, 2023
4ac297d
run on PR updates
fantavlik Aug 25, 2023
2c85bfc
debug linux issue
fantavlik Aug 25, 2023
cd82d73
Fix bug with 4 digit format of java version
fantavlik Aug 25, 2023
8025b67
cleanup and ready for review
fantavlik Aug 25, 2023
d566f07
Bump LSP version
fantavlik Aug 25, 2023
9230c79
Attempt acceptance test fix
fantavlik Aug 25, 2023
aa6448c
sleep after activation
fantavlik Aug 25, 2023
60ad825
Back to skipping acceptance test
fantavlik Aug 25, 2023
175d449
Turn acceptance tests back off for PRs, on for main/master
fantavlik Aug 25, 2023
fedfe0e
Add small fix to error messages
fantavlik Sep 7, 2023
1f71a49
Added error string.
fantavlik Sep 7, 2023
4eb08a3
Bump LSP to 2.0.375
fantavlik Sep 7, 2023
8b8acaa
Extend timeout for windows tests
fantavlik Sep 7, 2023
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
52 changes: 52 additions & 0 deletions .github/workflows/build-test.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,52 @@
name: Build and test
on:
push:
branches:
- main
- master
- develop
pull_request:
types: [opened, reopened, synchronize]

jobs:
unit-test:
strategy:
matrix:
os: [macos-latest, ubuntu-latest, windows-latest]
# Without this a failure in one OS will cancel jobs running for others
fail-fast: false
runs-on: ${{ matrix.os }}
steps:
- name: Checkout
uses: actions/checkout@v2
- name: Install Node.js
uses: actions/setup-node@v2
with:
node-version: 16
- run: npm install
- run: xvfb-run -a npm test
if: runner.os == 'Linux'
- run: npm test
if: runner.os != 'Linux'
functional-test:
strategy:
matrix:
os: [macos-latest, ubuntu-latest, windows-latest]
# Without this a failure in one OS will cancel jobs running for others
fail-fast: false
runs-on: ${{ matrix.os }}
steps:
- name: Checkout
uses: actions/checkout@v2
- name: Install Node.js
uses: actions/setup-node@v2
with:
node-version: 16
- run: npm install
- run: npm run compile-tests
- run: echo "Run acceptance tests" && node ./out/test/runFunctionalTests.js
if: runner.os == 'macOS'
- run: echo "Run acceptance tests" && xvfb-run -a node ./out/test/runFunctionalTests.js
if: runner.os == 'Linux'
- run: echo "Run acceptance tests" && node .\out\test\runFunctionalTests.js
if: runner.os == 'Windows'
26 changes: 0 additions & 26 deletions .github/workflows/ci.yaml

This file was deleted.

65 changes: 65 additions & 0 deletions .github/workflows/package-acceptance-test.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,65 @@
name: Package .vsix and run acceptance tests

on:
push:
tags:
- '*'

jobs:
package:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v2
- name: Install Node.js
uses: actions/setup-node@v2
with:
node-version: 16
- run: npm --version
- run: node --version
- run: npm install
- run: npm list
- run: npm run compile
- run: npm install -g @vscode/vsce
- run: vsce package
- uses: actions/upload-artifact@v3
with:
name: vsix-package
path: splunk-*.vsix
if-no-files-found: error

acceptance-test:
needs: package
strategy:
matrix:
os: [macos-latest, ubuntu-latest, windows-latest]
# Without this a failure in one OS will cancel jobs running for others
fail-fast: false
runs-on: ${{ matrix.os }}
steps:
- name: Checkout
uses: actions/checkout@v2
- name: Download package
uses: actions/download-artifact@v3
with:
name: vsix-package
- run: pwd
- run: ls -l *.vsix
if: runner.os != 'Windows'
- run: dir *.vsix
if: runner.os == 'Windows'
- name: Install Node.js
uses: actions/setup-node@v2
with:
node-version: 16
- run: npm --version
- run: node --version
- run: npm install
- run: npm list
- run: npm run compile-tests
- run: echo "Run acceptance tests" && node ./out/test/runAcceptanceTests.js
if: runner.os == 'macOS'
- run: echo "Run acceptance tests" && xvfb-run -a node ./out/test/runAcceptanceTests.js
if: runner.os == 'Linux'
- run: echo "Run acceptance tests" && node .\out\test\runAcceptanceTests.js
if: runner.os == 'Windows'
29 changes: 0 additions & 29 deletions .github/workflows/package-vsix.yaml

This file was deleted.

5 changes: 4 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -14,4 +14,7 @@ tsconfig.lsif.json
*.pyc
conf_diff.py
*.vsix
dist/
dist/
out/test
out/package.json
.vscode-test
34 changes: 33 additions & 1 deletion .vscode/launch.json
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,38 @@
"<node_internals>/**"
],
"type": "node"
}
},
{
"name": "Extension Functional Tests",
"type": "extensionHost",
"request": "launch",
"runtimeExecutable": "${execPath}",
"args": [
"--disable-extensions",
"--extensionDevelopmentPath=${workspaceFolder}",
"--extensionTestsPath=${workspaceFolder}/out/test/functional/index"
],
"outFiles": [
"${workspaceFolder}/out/**/*.js",
"${workspaceFolder}/out/**/*.json"
],
"preLaunchTask": "npm: compile-tests"
},
{
"name": "Extension Acceptance Tests",
"type": "extensionHost",
"request": "launch",
"runtimeExecutable": "${execPath}",
"args": [
"--disable-extensions",
"--extensionDevelopmentPath=${workspaceFolder}",
"--extensionTestsPath=${workspaceFolder}/out/test/acceptance/index"
],
"outFiles": [
"${workspaceFolder}/out/**/*.js",
"${workspaceFolder}/out/**/*.json"
],
"preLaunchTask": "npm: compile-tests"
}
]
}
11 changes: 10 additions & 1 deletion .vscode/tasks.json
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,15 @@
"kind": "build",
"isDefault": true
}
}
},
{
"type": "npm",
"script": "compile-tests",
"problemMatcher": ["$tsc"],
"isBackground": false,
"group": {
"kind": "build"
}
}
]
}
7 changes: 4 additions & 3 deletions out/extension.js
Original file line number Diff line number Diff line change
Expand Up @@ -254,7 +254,7 @@ async function activate(context) {

// Notebook
context.subscriptions.push(vscode.workspace.registerNotebookSerializer('splunk-notebook', new SplunkNotebookSerializer(), {transientCellMetadata: {inputCollapsed: true, outputCollapsed: true}, transientOutputs: false}));
context.subscriptions.push(vscode.workspace.registerNotebookSerializer('spl2-notebook', new Spl2NotebookSerializer(), {transientCellMetadata: {inputCollapsed: true, outputCollapsed: true}, transientOutputs: false}));
context.subscriptions.push(vscode.workspace.registerNotebookSerializer('spl2-notebook', new Spl2NotebookSerializer(), {transientCellMetadata: {inputCollapsed: true, outputCollapsed: true}, transientOutputs: false}));
const controller = new SplunkController();
context.subscriptions.push(controller);
const spl2Controller = new Spl2Controller();
Expand Down Expand Up @@ -340,9 +340,10 @@ async function handleSpl2Document(context, progressBar) {
return;
}
try {
const installedLatestLsp = await installMissingSpl2Requirements(context, progressBar);
const globalStoragePath = context.globalStorageUri.fsPath;
const installedLatestLsp = await installMissingSpl2Requirements(globalStoragePath, progressBar);
if (!installedLatestLsp) {
await getLatestSpl2Release(context, progressBar);
await getLatestSpl2Release(globalStoragePath, progressBar);
}
const onSpl2Restart = async (nextPort) => {
await spl2Client.deactivate();
Expand Down
11 changes: 4 additions & 7 deletions out/notebooks/spl2/initializer.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@ import * as child_process from 'child_process';
import { AddressInfo, Socket } from 'net';
import * as path from 'path';
import {
ExtensionContext,
StatusBarItem,
window,
workspace,
Expand Down Expand Up @@ -49,7 +48,7 @@ interface LSPLog {
message: string,
}

export async function startSpl2ClientAndServer(context: ExtensionContext, progressBar: StatusBarItem, portToAttempt: number, onClose: (nextPort: number) => void): Promise<Spl2ClientServer> {
export async function startSpl2ClientAndServer(globalStoragePath: string, progressBar: StatusBarItem, portToAttempt: number, onClose: (nextPort: number) => void): Promise<Spl2ClientServer> {
fantavlik marked this conversation as resolved.
Show resolved Hide resolved
return new Promise(async (resolve, reject) => {
try {
// If the user has already opted-out for good then stop here
Expand Down Expand Up @@ -77,9 +76,9 @@ export async function startSpl2ClientAndServer(context: ExtensionContext, progre
);
return;
}
const lspPath = path.join(getLocalLspDir(context), getLspFilename(lspVersion));
const lspPath = path.join(getLocalLspDir(globalStoragePath), getLspFilename(lspVersion));

const server = new Spl2ClientServer(context, progressBar, javaPath, lspPath, portToAttempt, onClose);
const server = new Spl2ClientServer(progressBar, javaPath, lspPath, portToAttempt, onClose);
await server.initialize();
resolve(server);
} catch (err) {
Expand All @@ -89,7 +88,6 @@ export async function startSpl2ClientAndServer(context: ExtensionContext, progre
}

export class Spl2ClientServer {
context: ExtensionContext;
progressBar: StatusBarItem;
javaPath: string;
lspPath: string;
Expand All @@ -103,8 +101,7 @@ export class Spl2ClientServer {
serverProcess: child_process.ChildProcess;
socket: Socket;

constructor(context: ExtensionContext, progressBar: StatusBarItem, javaPath: string, lspPath: string, portToAttempt: number, onClose: (nextPort: number) => void) {
this.context = context;
constructor(progressBar: StatusBarItem, javaPath: string, lspPath: string, portToAttempt: number, onClose: (nextPort: number) => void) {
this.progressBar = progressBar;
this.javaPath = javaPath;
this.lspPath = lspPath;
Expand Down
Loading
Loading