-
Notifications
You must be signed in to change notification settings - Fork 31
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix: smoke tests, change default cpu throttle to 0
- Loading branch information
tsubomi imamura
committed
Apr 11, 2022
1 parent
1949bc4
commit 83dfade
Showing
11 changed files
with
497 additions
and
35 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
set -e | ||
set -o pipefail | ||
|
||
pid=$(ps -ef|grep -i "test-server"|sort -k5,5|awk '{print $2}'|head -1) | ||
#echo "stop test server $pid" | ||
kill -9 $pid |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,60 @@ | ||
import * as express from 'express'; | ||
import { createParser } from 'dashdash'; | ||
import { Results, Option } from 'dashdash'; | ||
|
||
(async function() { | ||
const app = express(); | ||
|
||
type ServerOpt = { | ||
port: number; | ||
staticAssetFolder: string; | ||
} | ||
async function startServer(): Promise<void> { | ||
const { port, staticAssetFolder } = initServerOption(); | ||
app.use(express.static(staticAssetFolder)); | ||
|
||
return new Promise((resolve) => { | ||
app.listen(port, () => { | ||
console.log(`Ready to serve test pages at http://localhost:${port}`); | ||
resolve(); | ||
}); | ||
}); | ||
} | ||
|
||
function initServerOption(): ServerOpt { | ||
const options: Option[] = [ | ||
{ | ||
name: 'port', | ||
type: 'number', | ||
help: 'server port to listen to', | ||
}, { | ||
name: 'staticAssetFolder', | ||
type: 'string', | ||
help: 'directory of static assets', | ||
default: 'build' | ||
}, | ||
{ | ||
names: ['help', 'h'], | ||
type: 'bool', | ||
help: 'Print this help and exit.' | ||
} | ||
]; | ||
|
||
const parser = createParser({ options: options }); | ||
let opts: Results; | ||
let serverOpt: ServerOpt; | ||
try { | ||
opts = parser.parse(process.argv); | ||
serverOpt = { | ||
port: opts.port, | ||
staticAssetFolder: opts.staticAssetFolder | ||
} | ||
} catch (e) { | ||
console.error('server start up option error: %s', (e as Error).message); | ||
process.exit(1); | ||
} | ||
return serverOpt; | ||
} | ||
|
||
await startServer(); | ||
})(); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.