Skip to content

Conversation

@omus
Copy link
Member

@omus omus commented Jun 12, 2025

Allow users to specify the module name when using @service via @service <service_id> as <module_name> (mirroring import Pkg as P). This change is backwards compatible and the test suite around @service has been significantly improved.

Provides a work around for the issue: #716


@omus
Copy link
Member Author

omus commented Jun 12, 2025

Getting the doctests working for the examples using STS.get_caller_identity are being a pain so I'll disable them. I'll make an issue for this:

Error: doctest failure in ~/work/AWS.jl/AWS.jl/src/AWS.jl:148-158

```jldoctest service
julia> using AWS: @service

julia> @service STS
STS

julia> STS.get_caller_identity()
OrderedCollections.LittleDict{Union{String, Symbol}, Any, Vector{Union{String, Symbol}}, Vector{Any}} with 2 entries:
  "GetCallerIdentityResult" => LittleDict{Union{String, Symbol}, Any, Vector{Un…
  "ResponseMetadata"        => LittleDict{Union{String, Symbol}, Any, Vector{Un…
```

Subexpression:

STS.get_caller_identity()

Evaluated output:

ERROR: HTTP.Exceptions.StatusError(400, "PUT", "/latest/api/token", HTTP.Messages.Response:
"""
HTTP/1.1 400 Bad Request
Content-Type: text/xml; charset=utf-8
Server: Microsoft-IIS/10.0
Date: Thu, 12 Jun 2025 16:13:12 GMT
Content-Length: 322

<?xml version="1.0" encoding="utf-8"?>
<Error xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema">
    <Code>InvalidHttpVerb</Code>
    <Message>The HTTP verb specified was not recognized by the server.</Message>
    <Details>'PUT' is not a supported verb.</Details>
</Error>""")
Stacktrace:
  [1] refresh_token!(session::AWS.IMDS.Session, duration::Int16)
    @ AWS.IMDS ~/work/AWS.jl/AWS.jl/src/IMDS.jl:94
  [2] refresh_token!
    @ ~/work/AWS.jl/AWS.jl/src/IMDS.jl:53 [inlined]
  [3] request(session::AWS.IMDS.Session, method::String, path::String; kwargs::@Kwargs{})
    @ AWS.IMDS ~/work/AWS.jl/AWS.jl/src/IMDS.jl:104
  [4] request
    @ ~/work/AWS.jl/AWS.jl/src/IMDS.jl:100 [inlined]
  [5] get(session::AWS.IMDS.Session, path::String)
    @ AWS.IMDS ~/work/AWS.jl/AWS.jl/src/IMDS.jl:168
  [6] get
    @ ~/work/AWS.jl/AWS.jl/src/IMDS.jl:180 [inlined]
  [7] ec2_instance_credentials(profile::String)
    @ AWS ~/work/AWS.jl/AWS.jl/src/AWSCredentials.jl:233
  [8] (::AWS.var"#12#18"{String})()
    @ AWS ~/work/AWS.jl/AWS.jl/src/AWSCredentials.jl:132
  [9] AWS.AWSCredentials(; profile::Nothing, throw_cred_error::Bool)
    @ AWS ~/work/AWS.jl/AWS.jl/src/AWSCredentials.jl:138
 [10] AWSCredentials
    @ ~/work/AWS.jl/AWS.jl/src/AWSCredentials.jl:113 [inlined]
 [11] AWS.AWSConfig()
    @ AWS ~/work/AWS.jl/AWS.jl/src/AWSConfig.jl:32
 [12] #global_aws_config#89
    @ ~/work/AWS.jl/AWS.jl/src/AWS.jl:82 [inlined]
 [13] global_aws_config
    @ ~/work/AWS.jl/AWS.jl/src/AWS.jl:80 [inlined]
 [14] get_caller_identity()
    @ STS ~/work/AWS.jl/AWS.jl/src/services/sts.jl:722
 [15] top-level scope
    @ none:1

Expected output:

OrderedCollections.LittleDict{Union{String, Symbol}, Any, Vector{Union{String, Symbol}}, Vector{Any}} with 2 entries:
  "GetCallerIdentityResult" => LittleDict{Union{String, Symbol}, Any, Vector{Un…
  "ResponseMetadata"        => LittleDict{Union{String, Symbol}, Any, Vector{Un…

@omus omus requested a review from mattBrzezinski June 12, 2025 18:31
@omus
Copy link
Member Author

omus commented Jun 12, 2025

I think my Documenter issues will be fixed by #723

@omus omus added this pull request to the merge queue Jun 13, 2025
@github-merge-queue github-merge-queue bot removed this pull request from the merge queue due to failed status checks Jun 13, 2025
@omus
Copy link
Member Author

omus commented Jun 13, 2025

I just noticed that due to testing with multiple backends my @service tests were running twice which causes the modules they create to be re-created and produce a warning. To avoid that I have started to separate the unit tests from the integration tests. This is something I thought of doing when we switched to merge queues in #713 but didn't have a reason to do it yet.

I've just moved the tests I've made here to be in the unit test category and we'll need to refactor the remaining tests in another PR.

@omus omus added this pull request to the merge queue Jun 13, 2025
@github-merge-queue github-merge-queue bot removed this pull request from the merge queue due to failed status checks Jun 13, 2025
@omus omus added this pull request to the merge queue Jun 13, 2025
Merged via the queue into master with commit bdb518c Jun 13, 2025
7 checks passed
@omus omus deleted the cv/service-as branch June 13, 2025 16:18
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants