Родитель
8f1db56262
Коммит
331fd6f7fe
|
@ -0,0 +1,52 @@
|
|||
{
|
||||
"rootFileShare" : "wordpress",
|
||||
"namePrefix" : "compile-",
|
||||
|
||||
"testTargets" : {
|
||||
"services" : [
|
||||
{
|
||||
"Container" : "wordpress:cli-php7.4",
|
||||
"Ports" : [8080],
|
||||
"ExpectedDurationUntilReady" : "00:03:00",
|
||||
|
||||
"Shell" : "/bin/bash",
|
||||
"Run": {
|
||||
"ShellArguments": ["-c", "sleep 90; wp core download; wp config create --dbname=exampledb --dbuser=exampleuser --dbpass=examplepass --dbhost='127.0.0.1:3306' --locale=en_US; wp core install --url=localhost --title='test' --admin_user='test' --admin_email='test@test.com' --skip-email; wp plugin install $RAFT_WORK_DIRECTORY/../../swagger-plugin/wp-api-swaggerui.1.1.1.zip --activate; cd /var/www/html; wp rewrite structure '/%year%/%monthnum%/%postname%/'; wp server --debug --host=127.0.0.1"]
|
||||
},
|
||||
"Idle" : {
|
||||
"ShellArguments" : ["-c", "echo DebugMode; while true; do sleep 100000; done;"]
|
||||
},
|
||||
"OutputFolder" : "wordpress"
|
||||
},
|
||||
{
|
||||
"Container" : "mysql:5.7",
|
||||
"Ports" : [3306, 33060],
|
||||
"EnvironmentVariables": {
|
||||
|
||||
"MYSQL_DATABASE": "exampledb",
|
||||
"MYSQL_USER": "exampleuser",
|
||||
"MYSQL_PASSWORD": "examplepass",
|
||||
"MYSQL_RANDOM_ROOT_PASSWORD": "1"
|
||||
}
|
||||
}
|
||||
]
|
||||
},
|
||||
"testTasks" : {
|
||||
"targetConfiguration" :{
|
||||
"apiSpecifications" : [ "http://localhost:8080/rest-api/schema" ],
|
||||
"endpoint" : "http://localhost:8080"
|
||||
},
|
||||
"tasks": [
|
||||
{
|
||||
"toolName": "RESTler",
|
||||
"outputFolder": "compile",
|
||||
"toolConfiguration": {
|
||||
"task": "Compile"
|
||||
}
|
||||
}
|
||||
]
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
|
@ -0,0 +1,44 @@
|
|||
# Copyright (c) Microsoft Corporation.
|
||||
# Licensed under the MIT License.
|
||||
|
||||
import pathlib
|
||||
import sys
|
||||
import os
|
||||
import json
|
||||
|
||||
cur_dir = os.path.dirname(os.path.abspath(__file__))
|
||||
sys.path.append(os.path.join(cur_dir, '..', '..', '..'))
|
||||
from raft_sdk.raft_service import RaftCLI, RaftJobConfig, RaftJobError, RaftDefinitions
|
||||
|
||||
def run(cli, config, subs):
|
||||
# Create compilation job configuration
|
||||
job_config = RaftJobConfig(file_path=config, substitutions=subs)
|
||||
print(f'Running {config}')
|
||||
# submit a new job with the Compile config and get new job ID
|
||||
job = cli.new_job(job_config)
|
||||
# wait for a job with ID from compile_job to finish the run
|
||||
cli.poll(job['jobId'])
|
||||
return job['jobId']
|
||||
|
||||
if __name__ == "__main__":
|
||||
try:
|
||||
# instantiate RAFT CLI
|
||||
cli = RaftCLI()
|
||||
compile_job_id = None
|
||||
|
||||
subs = {
|
||||
}
|
||||
for arg in sys.argv[1:]:
|
||||
if arg == 'compile':
|
||||
compile_job_id = run(cli, os.path.join(cur_dir, 'compile.json'), subs)
|
||||
subs['{compile.jobId}'] = compile_job_id
|
||||
|
||||
if arg == 'test':
|
||||
run(cli, os.path.join(cur_dir, "test.json"), subs),
|
||||
|
||||
if arg == 'test-fuzz-lean':
|
||||
run(cli, os.path.join(cur_dir, "test-fuzz-lean.json"), subs),
|
||||
|
||||
except RaftJobError as ex:
|
||||
print(f'ERROR: {ex.message}')
|
||||
sys.exit(1)
|
|
@ -0,0 +1,52 @@
|
|||
{
|
||||
"rootFileShare" : "wordpress",
|
||||
"namePrefix" : "fuzz-lean-",
|
||||
|
||||
"resources": {
|
||||
"Cores": 4,
|
||||
"MemoryGBs": 8
|
||||
},
|
||||
|
||||
"readonlyFileShareMounts": [
|
||||
{
|
||||
"FileShareName": "{ci-run}",
|
||||
"MountPath": "/ci-run"
|
||||
}
|
||||
],
|
||||
|
||||
"testTargets" : {
|
||||
"resources" : {
|
||||
"Cores" : 2,
|
||||
"MemoryGBs" : 4
|
||||
},
|
||||
"targets" : [
|
||||
{
|
||||
"Container" : "swaggerapi/petstore3",
|
||||
"Port" : 8081,
|
||||
"OutputFolder" : "petstore3",
|
||||
"ExpectedDurationUntilReady" : "00:02:00",
|
||||
"Run" : {
|
||||
"Command" : "/bin/sh",
|
||||
"Arguments" : ["-c", "java -jar /swagger-petstore/jetty-runner.jar --log $RAFT_WORK_DIRECTORY/yyyy_mm_dd-requests.log --port 8081 /swagger-petstore/server.war"]
|
||||
}
|
||||
}
|
||||
]
|
||||
},
|
||||
"tasks": [
|
||||
{
|
||||
"toolName": "RESTler",
|
||||
"outputFolder": "test-fuzz-lean",
|
||||
"duration": "01:00:00",
|
||||
"toolConfiguration": {
|
||||
"task": "TestFuzzLean",
|
||||
"runConfiguration": {
|
||||
"targetEndpointConfiguration" : {
|
||||
"Port" : 8081
|
||||
},
|
||||
"useSsl" : false,
|
||||
"inputFolderPath": "/ci-run/{compile.jobId}/compile"
|
||||
}
|
||||
}
|
||||
}
|
||||
]
|
||||
}
|
|
@ -0,0 +1,68 @@
|
|||
{
|
||||
"rootFileShare" : "wordpress",
|
||||
"namePrefix" : "test-",
|
||||
|
||||
"resources": {
|
||||
"Cores": 4,
|
||||
"MemoryGBs": 8
|
||||
},
|
||||
|
||||
"readonlyFileShareMounts": [
|
||||
{
|
||||
"FileShareName": "wordpress",
|
||||
"MountPath": "/wordpress"
|
||||
}
|
||||
],
|
||||
|
||||
"testTargets" : {
|
||||
"resources" : {
|
||||
"Cores" : 3,
|
||||
"MemoryGBs" : 6
|
||||
},
|
||||
"services" : [
|
||||
{
|
||||
"Container" : "wordpress:cli-php7.4",
|
||||
"Ports" : [8080],
|
||||
"ExpectedDurationUntilReady" : "00:03:00",
|
||||
|
||||
"Shell" : "/bin/bash",
|
||||
"Run": {
|
||||
"ShellArguments": ["-c", "sleep 90; wp core download; wp config create --dbname=exampledb --dbuser=exampleuser --dbpass=examplepass --dbhost='127.0.0.1:3306' --locale=en_US; wp core install --url=localhost --title='test' --admin_user='test' --admin_email='test@test.com' --skip-email; wp plugin install $RAFT_WORK_DIRECTORY/../../swagger-plugin/wp-api-swaggerui.1.1.1.zip --activate; cd /var/www/html; wp rewrite structure '/%year%/%monthnum%/%postname%/'; wp server --debug --host=127.0.0.1" ]
|
||||
},
|
||||
"Idle" : {
|
||||
"ShellArguments" : ["-c", "echo DebugMode; while true; do sleep 100000; done;"]
|
||||
},
|
||||
"OutputFolder" : "wordpress"
|
||||
},
|
||||
{
|
||||
"Container" : "mysql:5.7",
|
||||
"Ports" : [3306, 33060],
|
||||
"EnvironmentVariables": {
|
||||
|
||||
"MYSQL_DATABASE": "exampledb",
|
||||
"MYSQL_USER": "exampleuser",
|
||||
"MYSQL_PASSWORD": "examplepass",
|
||||
"MYSQL_RANDOM_ROOT_PASSWORD": "1"
|
||||
}
|
||||
}
|
||||
]
|
||||
},
|
||||
"testTasks" : {
|
||||
"targetConfiguration" :{
|
||||
"endpoint" : "http://127.0.0.1:8080"
|
||||
},
|
||||
"tasks": [
|
||||
{
|
||||
"toolName": "RESTler",
|
||||
"outputFolder": "test",
|
||||
"toolConfiguration": {
|
||||
"task": "Test",
|
||||
"runConfiguration" : {
|
||||
"useSsl" : false,
|
||||
"inputFolderPath": "/wordpress/{compile.jobId}/compile"
|
||||
}
|
||||
}
|
||||
}
|
||||
]
|
||||
}
|
||||
}
|
|
@ -585,7 +585,14 @@ let main argv =
|
|||
else
|
||||
match System.Uri.TryCreate(apiSpecificationLocation, UriKind.Absolute) with
|
||||
| true, url ->
|
||||
let! apiSpecification = downloadFile workDirectory (Array.last url.Segments) apiSpecificationLocation
|
||||
let fileName =
|
||||
let fn = Array.last url.Segments
|
||||
if List.contains (IO.FileInfo(fn).Extension.ToLower()) [".json"; ".yml"; ".yaml"] then
|
||||
fn
|
||||
else
|
||||
fn + ".json"
|
||||
|
||||
let! apiSpecification = downloadFile workDirectory fileName apiSpecificationLocation
|
||||
printfn "Downloaded apiSpecification spec to :%s" apiSpecification
|
||||
return apiSpecification
|
||||
| false, _ ->
|
||||
|
|
Загрузка…
Ссылка в новой задаче