-
Notifications
You must be signed in to change notification settings - Fork 25
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
Conversation
… accepted already
@@ -53,6 +53,7 @@ export async function installMissingSpl2Requirements(context: ExtensionContext, | |||
} | |||
} catch (err) { | |||
reject(`Error retrieving configuration '${configKeyJavaPath}', err: ${err}`); | |||
return Promise.resolve(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
These new Promise
statements fix an issue @JasonConger and I saw during a demo of mine where the installation process can get stuck in a loop - we were not actually exiting the function after resolving the promise for a bunch of cases.
} | ||
} else if (!javaLoc) { | ||
} else if (!javaLoc && termsStatus !== TermsAcceptanceStatus.Accepted) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Fixes and issue where we were prompting to accept terms even if you already had accepted them
try { | ||
const javaVerCmd = child_process.spawnSync(javaLoc, ['-version'], { encoding : 'utf8' }); | ||
if (!javaVerCmd || javaVerCmd.stdout) { | ||
return false; | ||
} | ||
// java -version actually writes to stderr so check for a match there | ||
const match = javaVerCmd.stderr.toString().match(/version \"([0-9]+)\.[0-9]+\.[0-9]\"/m); | ||
output = javaVerCmd.stderr.toString(); | ||
const match = output.match(/version \"([0-9]+)\.[0-9]+\.[0-9].*\"/m); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This fixes a linux issue where Java version of format openjdk version "17.0.8.1"
was not being parsed correctly
progressBar.text = `${progressBarText}...`; | ||
await extract(zipfilePath, { dir: extractPath, onEntry: (entry, zipfile) => { | ||
if (entry.fileName.endsWith(path.join('bin', 'java.exe'))) { | ||
if (entry.fileName.endsWith('bin/java.exe') || entry.fileName.endsWith('bin\\java.exe')) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This addresses a Windows installation issue found during testing!
Added testing
Most of the Splunk Extension code depends on the
vscode
package which requires a running instance of vscode to work. This PR adds testing harnesses using@vscode/test-electron
using these resources as guidance:Functional tests: these import the code directly so that individual functions can be tested similar to unit tests but with a running instance of vscode
Acceptance tests: these actually install the packaged
.vsix
version of the Extension into running VSCode instance in the testing environment. Unfortunately I wasn't able to get a meaningful test working yet with this but it was quite a lot of work just getting the harness working across platforms so I thought it would still be useful to work off of moving forward.Bugfixes
openjdk version "17.0.8.1"
or similarjava.exe
being checked for Linux/Macresolve()
Bump LSP
2.0.375