Skip to content

Commit

Permalink
Merge pull request #40 from JuliaComputing/tan/ci
Browse files Browse the repository at this point in the history
run a subset of tests for openapi-generator
  • Loading branch information
tanmaykm authored Jul 13, 2023
2 parents 0eddd7c + 9a8ffb1 commit ab990fc
Show file tree
Hide file tree
Showing 4 changed files with 22 additions and 17 deletions.
2 changes: 1 addition & 1 deletion Project.toml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ keywords = ["Swagger", "OpenAPI", "REST"]
license = "MIT"
desc = "OpenAPI server and client helper for Julia"
authors = ["JuliaHub Inc."]
version = "0.1.11"
version = "0.1.12"

[deps]
Base64 = "2a0f44e3-6c83-55bd-87e4-b1978d98bd5f"
Expand Down
26 changes: 14 additions & 12 deletions test/client/runtests.jl
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ include("utilstests.jl")
include("petstore_v3/runtests.jl")
include("petstore_v2/runtests.jl")

function runtests()
function runtests(; skip_petstore=false)
@testset "Client" begin
@testset "Utils" begin
test_longpoll_exception_check()
Expand All @@ -20,18 +20,20 @@ function runtests()
@testset "Validations" begin
test_validations()
end
@testset "Petstore" begin
if get(ENV, "RUNNER_OS", "") == "Linux"
@testset "V3" begin
@info("Running petstore v3 tests")
PetStoreV3Tests.runtests()
if !skip_petstore
@testset "Petstore" begin
if get(ENV, "RUNNER_OS", "") == "Linux"
@testset "V3" begin
@info("Running petstore v3 tests")
PetStoreV3Tests.runtests()
end
@testset "V2" begin
@info("Running petstore v2 tests")
PetStoreV2Tests.runtests()
end
else
@info("Skipping petstore tests in non Linux environment (can not run petstore docker on OSX or Windows)")
end
@testset "V2" begin
@info("Running petstore v2 tests")
PetStoreV2Tests.runtests()
end
else
@info("Skipping petstore tests in non Linux environment (can not run petstore docker on OSX or Windows)")
end
end
end
Expand Down
8 changes: 4 additions & 4 deletions test/runtests.jl
Original file line number Diff line number Diff line change
Expand Up @@ -11,20 +11,20 @@ include("client/allany/runtests.jl")
end
@testset "Client" begin
try
if run_tests_with_servers
if run_tests_with_servers && !openapi_generator_env
run(`client/petstore_v2/start_petstore_server.sh`)
run(`client/petstore_v3/start_petstore_server.sh`)
sleep(20) # let servers start
end
OpenAPIClientTests.runtests()
OpenAPIClientTests.runtests(; skip_petstore=openapi_generator_env)
finally
if run_tests_with_servers
if run_tests_with_servers && !openapi_generator_env
run(`client/petstore_v2/stop_petstore_server.sh`)
run(`client/petstore_v3/stop_petstore_server.sh`)
end
end
end
run_tests_with_servers && sleep(20) # avoid port conflicts
run_tests_with_servers && !openapi_generator_env && sleep(20) # avoid port conflicts
@testset "Server" begin
v2_ret = v2_out = v3_ret = v3_out = nothing
servers_running = true
Expand Down
3 changes: 3 additions & 0 deletions test/testutils.jl
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,9 @@ const startup_flag = `--startup-file=no`
# can run servers only on linux for now
const run_tests_with_servers = get(ENV, "RUNNER_OS", "") == "Linux"

# can only run a subset of tests when running on openapi-generator repo
const openapi_generator_env = get(ENV, "OPENAPI_GENERATOR", "false") == "true"

function run_server(script, flags=``)
use_pkgimages = VERSION >= v"1.9" ? `--pkgimages=no` : ``
srvrcmd = `$(joinpath(Sys.BINDIR, "julia")) $use_pkgimages $startup_flag $cov_flag $inline_flag $script $flags`
Expand Down

2 comments on commit ab990fc

@tanmaykm
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@JuliaRegistrator
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Registration pull request created: JuliaRegistries/General/87393

After the above pull request is merged, it is recommended that a tag is created on this repository for the registered package version.

This will be done automatically if the Julia TagBot GitHub Action is installed, or can be done manually through the github interface, or via:

git tag -a v0.1.12 -m "<description of version>" ab990fc0656e315e0034e77c4fe29f0d7771bdbc
git push origin v0.1.12

Please sign in to comment.