Skip to content
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

Avoid duplicate includes causing warnings in tests #689

Open
wants to merge 4 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion test/AWS.jl
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
@testset "service module" begin
@service S3
@test :S3 in names(Main)
@test isdefined(@__MODULE__, :S3)
end

@testset "global config, kwargs" begin
Expand Down
116 changes: 64 additions & 52 deletions test/runtests.jl
Original file line number Diff line number Diff line change
@@ -1,58 +1,67 @@
using AWS
using AWS: AWSCredentials, AWSServices, assume_role_creds
using AWS.AWSExceptions:
AWSException, IMDSUnavailable, InvalidFileName, NoCredentials, ProtocolNotDefined
using AWS.AWSMetadata:
ServiceFile,
_clean_documentation,
_filter_latest_service_version,
_generate_low_level_definition,
_generate_high_level_definition,
_generate_high_level_definitions,
_get_service_files,
_get_service_and_version,
_get_function_parameters,
_clean_uri,
_format_name,
_splitline,
_wraplines,
_validindex
using Base64
using Compat: mergewith
using Dates
using Downloads
using GitHub
using HTTP
using IniFile: Inifile
using JSON
using OrderedCollections: LittleDict, OrderedDict
using MbedTLS: digest, MD_SHA256, MD_MD5
using Mocking
using Pkg
using Random
using Suppressor
using Test
using UUIDs
using XMLDict
using StableRNGs
const TOP_LEVEL_STUFF = quote
using AWS
using AWS: AWSCredentials, AWSServices, assume_role_creds
using AWS.AWSExceptions:
AWSException,
IMDSUnavailable,
InvalidFileName,
NoCredentials,
ProtocolNotDefined
using AWS.AWSMetadata:
ServiceFile,
_clean_documentation,
_filter_latest_service_version,
_generate_low_level_definition,
_generate_high_level_definition,
_generate_high_level_definitions,
_get_service_files,
_get_service_and_version,
_get_function_parameters,
_clean_uri,
_format_name,
_splitline,
_wraplines,
_validindex
using Base64
using Compat: mergewith
using Dates
using Downloads
using GitHub
using HTTP
using IniFile: Inifile
using JSON
using OrderedCollections: LittleDict, OrderedDict
using MbedTLS: digest, MD_SHA256, MD_MD5
using Mocking
using Pkg
using Random
using Suppressor
using Test
using UUIDs
using XMLDict
using StableRNGs

Mocking.activate()
Mocking.activate()

include("patch.jl")
include("resources/totp.jl")
Base.include(@__MODULE__, "patch.jl")
Base.include(@__MODULE__, "resources/totp.jl")

const _NOW_FMT = DateFormat("yyyymmdd\\THHMMSSsss\\Z")

function _now_formatted()
return lowercase(Dates.format(now(Dates.UTC), _NOW_FMT))
end

testset_role(role_name) = string("AWS.jl-", role_name)
end
eval(TOP_LEVEL_STUFF) # ensure things are loaded/defined in Main

const TEST_MINIO = begin
all(k -> haskey(ENV, k), ("MINIO_ACCESS_KEY", "MINIO_SECRET_KEY", "MINIO_REGION_NAME"))
end

aws = AWSConfig()

function _now_formatted()
return lowercase(Dates.format(now(Dates.UTC), dateformat"yyyymmdd\THHMMSSsss\Z"))
end

testset_role(role_name) = "AWS.jl-$role_name"

@testset "AWS.jl" begin
include("AWSExceptions.jl")
include("AWSMetadataUtilities.jl")
Expand All @@ -63,14 +72,17 @@ testset_role(role_name) = "AWS.jl-$role_name"
backends = [AWS.HTTPBackend, AWS.DownloadsBackend]
@testset "Backend: $(nameof(backend))" for backend in backends
AWS.DEFAULT_BACKEND[] = backend()
include("AWS.jl")
include("IMDS.jl")
include("AWSCredentials.jl")
include("role.jl")
include("issues.jl")
M = Module(Symbol(:Test, nameof(backend)))
Core.eval(M, TOP_LEVEL_STUFF) # ensure things are loaded/defined in this module too
Core.eval(M, :(using ..Main: aws))
Base.include(M, "AWS.jl")
Base.include(M, "IMDS.jl")
Base.include(M, "AWSCredentials.jl")
Base.include(M, "role.jl")
Base.include(M, "issues.jl")

if TEST_MINIO
include("minio.jl")
Base.include(M, "minio.jl")
end
end
end
Loading