ec2test: handle CreateTags action #50

Merged
merged 1 commit into from May 22, 2015

Conversation

Projects
None yet
2 participants
Member

axw commented May 21, 2015

This commit adds support for the CreateTags
action to the test server, and an accompanying
test. Live tested.

ec2/ec2t_test.go
+ "tag10": "",
+ })
+
+ _, err = s.ec2.CreateTags([]string{id}, []ec2.Tag{{"tag11", ""}})
@wallyworld

wallyworld May 22, 2015

Member

tag limit exceeded should be a separate test, strictly speaking
similar to create tags invalid test below

@axw

axw May 22, 2015

Member

done

+ }
+ i := atoi(fields[1])
+ for i > len(tags) {
+ tags = append(tags, ec2.Tag{})
@wallyworld

wallyworld May 22, 2015

Member

is this right? it will append to tags slice but the slot it ends up in won't necessarily match i

what if we have:

Tag.1.Key
Tag.1.Value
Tag.3.Key
Tag.3.Value

then the tag 3 value will end up in the slot for tag 2.

Is the above possible? Or is it enforced that there must be a tag 1 and tag 2 and tag 3 etc, not missing values like tag 1 and tag 2 and tag4. Either way, I think another test is needed

@axw

axw May 22, 2015

Member

Tag.1.Key
Tag.1.Value

At this point: tags is empty, i is 1. It'll add a single empty ec2.Tag to tags, and then below will set the i-1'th element (i.e. index 0 in this case) to the key/value.

tags == []ec2.Tag{{"Tag.1.Key", "Tag.1.Value"}}

Tag.3.Key
Tag.3.Value

Now tags has len==1, and i is 3. The code will add two empty ec2.Tags to tags, and below will set the element at index 2 to the key/value. So at this point we'd have:

tags == []ec2.Tag{{"Tag.1.Key", "Tag.1.Value"}, {}, {"Tag.2.Key", "Tag.2.Value"}}

Is the above possible? Or is it enforced that there must be a tag 1 and tag 2 and tag 3 etc, not missing values like tag 1 and tag 2 and tag4. Either way, I think another test is needed

The values are going in the right places. I'd say it's an error to have non-contiguous sequence numbers. We don't have to test every possible scenario in the test server, though; only the ones that we actually run. We will never generate such parameters, so it's not worth trying to bend the code to test it.

Member

wallyworld commented May 22, 2015

LGTM with question about tags either answered or fixed

ec2test: handle CreateTags action
This commit adds support for the CreateTags
action to the test server, and an accompanying
test. Live tested.

axw added a commit that referenced this pull request May 22, 2015

Merge pull request #50 from axw/createtags-tests
ec2test: handle CreateTags action

@axw axw merged commit fde8680 into go-amz:v3 May 22, 2015

1 check passed

continuous-integration/travis-ci/pr The Travis CI build passed
Details
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment