-
Notifications
You must be signed in to change notification settings - Fork 146
Refactor for CreateQueue for V1 JSON support #289
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
Conversation
It looks like a lot of progress has been made here ( 😃 ), I can see in the docker logs that many SQS operations seem to be successful, however my tests are failing at the teardown stage as they are unable to purge queues.
|
@Matthew-Davey Could you give me some info on how you are testing this? Like - which SDK are you using? Also, have you got this automated somehow? (If so that would be huuuuuuuge here. I've been meaning to do that for ages. 😄 ) I'm looking through the SDK's now, and the python one at least ( |
@Matthew-Davey Following up on the above, some information would be helpful when you can. Thanks! |
Ok, I think ffa95eb is the last of the required code for the CreateQueue action and the basis of the others. Though I still want to smoke test this against an SDK that's doing JSON now. All the one's I've tried say they support it but aren't actually making calls with it - at least not to CreateQueue. Feedback/word on this would be appreciated. NOTE: there are things we can improve on later and if you see things feel free to shout/make issues/etc., but I think this is workable for now. In the meantime, future endpoints more or less could be accomplished with the following steps. (Probably missing some steps, but this should be the bulk - I will update if we find things)
|
@dhumphreys01 @Admiral-Piett How about creating a separate PR corresponding to smoke-test and adding it to |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@Admiral-Piett @dhumphreys01
I think this idea would work! 👍
My ideal architecture was to solve the protocol concerns around the router.go
and have gosqs.go
gosns.go
not depend on the http package (For example, the argument of CreateQueueV1
would be models.CreateQueueRequest
).
However, my idea will be much bigger than this, so I think it is better to apply your current idea to other SQS/SNS APIs and test it working first!
if app.CurrentEnvironment.QueueAttributeDefaults.MessageRetentionPeriod <= 0 { | ||
app.CurrentEnvironment.QueueAttributeDefaults.MessageRetentionPeriod = 345600 // 4 days | ||
} | ||
|
||
if app.CurrentEnvironment.QueueAttributeDefaults.ReceiveMessageWaitTimeSeconds <= 0 { | ||
app.CurrentEnvironment.QueueAttributeDefaults.ReceiveMessageWaitTimeSeconds = 0 | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@Admiral-Piett @dhumphreys01
Would it be good to support these latest QueueAttributes in master
branch separately from the aws-json consideration?
If I understand correctly, you can currently use these attributes with the aws-query protocol in the Amazon SQS service, right?
https://docs.aws.amazon.com/AWSSimpleQueueService/latest/APIReference/API_SetQueueAttributes.html#API_SetQueueAttributes_RequestSyntax
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think these attributes were all technically supported before, these are just the defaults for if there wasn't anything in the config files. I was trying to avoid adding new things for your point there, but I had some bugs that pushed me into this territory. There might be one of them that's mentioned in some comments that I added, but it doesn't actually do anything I don't think it just gets captured.
Thanks for taking a look at this @kojisaikiAtSony! In general I think you're right about trying to break a lot of this up - but you're going to have to forgive me, because I just don't have the bandwidth to take it all in steps the way I would like to. I don't have time to go and write them all up as smoke tests before hand - since doing that means I have to plumb the depths of each endpoint and I can only afford to do that once. So I think we need to fill them in as we go - because I want this huge change to be backed by automated tests. I can't keep up with it all otherwise. I know it's annoying, and a lot to sift through, and I'm sorry, but I think we've just got to grit our teeth and cut that corner. If you have any trouble following this let me know - we can even arrange a zoom call to talk through some of it if that's helpful. Also, in terms of the |
I tried V1 flow on SQS.SendMessage API on #291. |
@Admiral-Piett A concern with testing with the AWS SDK is that we can only use one SDK version, so we cannot test
We can find the SDK version here: |
It may be a bit rough, but by taking advantage of the fact that there are v1 and v2 of separeted AWS SDK Go, we might be able to test aws-query using SDK v1 |
I created the PoC on the E2E testing idea: #292 In the PoC, I was convinced that it was necessary to separate the protocol context from |
@kojisaikiAtSony I really liked your ideas I used several of them, though I think my style differed slightly. If you prefer some style changes that will make it easier to consume (or any others of course) just shout - I'm open to chatting about it. I I tested this against both styles of the SDK (luckily the python one hasn't updated to JSON and I had that handy, along with the Golang one), looks good prelimiarily. I got the memory issue in the smoke tests too I think - watch out for the global memory resources. They are hold-over even across instances of the server. I wrote a utility to wipe them that you can call at the end of tests until I can figure out a long term strategy. Otherwise, I really liked your idea about incorporating the SDK into the automated tests - so I'm going to try to work on that at least for the JSON requests and go from there. After that I think it's about there. So let me know what you think about this? If you agree, hopefully this will put us in a good space to knock out the rest more easily. Thanks for sticking with this! |
3675f0f
to
1babc4e
Compare
Nice workaround! 👍
OK! The latest end-to-end app behavior looks good. I also think the testing approach is good, so please continue the work 👍 Next time, I'll try updating the SendMessage implementation (#291). At that time, I will consider the idea of layer division a little. |
fa5ea7b
to
714dcb8
Compare
714dcb8
to
a323e5f
Compare
6733100
to
44e22ae
Compare
@kojisaiki Ok, this is ready for review I think - finally. You may have noticed my other question out here - #288 (comment). Let me know what you think there? I don't want to step on your toes, but these changes look fairly old now. If we can remove them then this is ready for your opinion and hopefully we can get it merged shortly and divide and conquer the rest of it. |
No problem, you can remove my old commits/codes completely that are from #285 (I closed the PR) 👍 |
func Test_CreateQueueV1_xml_with_attributes(t *testing.T) { | ||
server := generateServer() | ||
defer func() { | ||
server.Close() | ||
utils.ResetResources() | ||
}() | ||
|
||
utils.InitializeDecoders() | ||
|
||
e := httpexpect.Default(t, server.URL) | ||
|
||
e.POST("/"). | ||
WithHeaders(map[string]string{ | ||
"Content-Type": "application/x-amz-json-1.0", |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The test name is ...xml...
, but the test request looks using aws-json
.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It seems that the test name and the protocol actually used for the other tests are different, so could you please review them?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
That is just to create a basic queue first so that I can set it as the Dead Letter Queue in the attributes below. If that queue doesn't exist when I make the second request it will error. But it's not particularly important in and of itself.
Below, the next queue is created with XML which is the one with attributes populated - and the one I am asserting on at the end.
44e22ae
to
d6568e7
Compare
This is a pretty rough draft of what I had in mind for our previous conversations. If we like where this is headed, I'll fix it up a bit, rename everything away from just
V1
, and fix all the TODO's.Preliminarily I think it works for both XML and JSON flows.