Skip to content

Commit ab990fc

Browse files
authored
Merge pull request #40 from JuliaComputing/tan/ci
run a subset of tests for openapi-generator
2 parents 0eddd7c + 9a8ffb1 commit ab990fc

File tree

4 files changed

+22
-17
lines changed

4 files changed

+22
-17
lines changed

Project.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ keywords = ["Swagger", "OpenAPI", "REST"]
44
license = "MIT"
55
desc = "OpenAPI server and client helper for Julia"
66
authors = ["JuliaHub Inc."]
7-
version = "0.1.11"
7+
version = "0.1.12"
88

99
[deps]
1010
Base64 = "2a0f44e3-6c83-55bd-87e4-b1978d98bd5f"

test/client/runtests.jl

Lines changed: 14 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ include("utilstests.jl")
88
include("petstore_v3/runtests.jl")
99
include("petstore_v2/runtests.jl")
1010

11-
function runtests()
11+
function runtests(; skip_petstore=false)
1212
@testset "Client" begin
1313
@testset "Utils" begin
1414
test_longpoll_exception_check()
@@ -20,18 +20,20 @@ function runtests()
2020
@testset "Validations" begin
2121
test_validations()
2222
end
23-
@testset "Petstore" begin
24-
if get(ENV, "RUNNER_OS", "") == "Linux"
25-
@testset "V3" begin
26-
@info("Running petstore v3 tests")
27-
PetStoreV3Tests.runtests()
23+
if !skip_petstore
24+
@testset "Petstore" begin
25+
if get(ENV, "RUNNER_OS", "") == "Linux"
26+
@testset "V3" begin
27+
@info("Running petstore v3 tests")
28+
PetStoreV3Tests.runtests()
29+
end
30+
@testset "V2" begin
31+
@info("Running petstore v2 tests")
32+
PetStoreV2Tests.runtests()
33+
end
34+
else
35+
@info("Skipping petstore tests in non Linux environment (can not run petstore docker on OSX or Windows)")
2836
end
29-
@testset "V2" begin
30-
@info("Running petstore v2 tests")
31-
PetStoreV2Tests.runtests()
32-
end
33-
else
34-
@info("Skipping petstore tests in non Linux environment (can not run petstore docker on OSX or Windows)")
3537
end
3638
end
3739
end

test/runtests.jl

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -11,20 +11,20 @@ include("client/allany/runtests.jl")
1111
end
1212
@testset "Client" begin
1313
try
14-
if run_tests_with_servers
14+
if run_tests_with_servers && !openapi_generator_env
1515
run(`client/petstore_v2/start_petstore_server.sh`)
1616
run(`client/petstore_v3/start_petstore_server.sh`)
1717
sleep(20) # let servers start
1818
end
19-
OpenAPIClientTests.runtests()
19+
OpenAPIClientTests.runtests(; skip_petstore=openapi_generator_env)
2020
finally
21-
if run_tests_with_servers
21+
if run_tests_with_servers && !openapi_generator_env
2222
run(`client/petstore_v2/stop_petstore_server.sh`)
2323
run(`client/petstore_v3/stop_petstore_server.sh`)
2424
end
2525
end
2626
end
27-
run_tests_with_servers && sleep(20) # avoid port conflicts
27+
run_tests_with_servers && !openapi_generator_env && sleep(20) # avoid port conflicts
2828
@testset "Server" begin
2929
v2_ret = v2_out = v3_ret = v3_out = nothing
3030
servers_running = true

test/testutils.jl

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,9 @@ const startup_flag = `--startup-file=no`
88
# can run servers only on linux for now
99
const run_tests_with_servers = get(ENV, "RUNNER_OS", "") == "Linux"
1010

11+
# can only run a subset of tests when running on openapi-generator repo
12+
const openapi_generator_env = get(ENV, "OPENAPI_GENERATOR", "false") == "true"
13+
1114
function run_server(script, flags=``)
1215
use_pkgimages = VERSION >= v"1.9" ? `--pkgimages=no` : ``
1316
srvrcmd = `$(joinpath(Sys.BINDIR, "julia")) $use_pkgimages $startup_flag $cov_flag $inline_flag $script $flags`

0 commit comments

Comments
 (0)