Merge lp:~axwalk/goamz/ec2test-empty-dnsname into lp:goamz
Proposed by
Andrew Wilkins
Status: | Merged |
---|---|
Merged at revision: | 44 |
Proposed branch: | lp:~axwalk/goamz/ec2test-empty-dnsname |
Merge into: | lp:goamz |
Diff against target: |
34 lines (+11/-2) 1 file modified
ec2/ec2test/server.go (+11/-2) |
To merge this branch: | bzr merge lp:~axwalk/goamz/ec2test-empty-dnsname |
Related bugs: |
Reviewer | Review Type | Date Requested | Status |
---|---|---|---|
goamz maintainers | Pending | ||
Review via email: mp+199466@code.launchpad.net |
Commit message
ec2/ec2test: set empty DNSName initially
Initially set empty DNSName, causing the
client to re-request the DNSName. This
exercises the address refreshing logic
in juju's ec2 provider.
Description of the change
ec2/ec2test: set empty DNSName initially
Initially set empty DNSName, causing the
client to re-request the DNSName. This
exercises the address refreshing logic
in juju's ec2 provider.
To post a comment you must log in.
Reviewers: mp+199466_ code.launchpad. net,
Message:
Please take a look.
Description:
ec2/ec2test: set empty DNSName initially
Initially set empty DNSName, causing the
client to re-request the DNSName. This
exercises the address refreshing logic
in juju's ec2 provider.
https:/ /code.launchpad .net/~axwalk/ goamz/ec2test- empty-dnsname/ +merge/ 199466
(do not edit description out of merge proposal)
Please review this at https:/ /codereview. appspot. com/43650045/
Affected files (+13, -2 lines): server. go
A [revision details]
M ec2/ec2test/
Index: [revision details]
=== added file '[revision details]'
--- [revision details] 2012-01-01 00:00:00 +0000
+++ [revision details] 2012-01-01 00:00:00 +0000
@@ -0,0 +1,2 @@
+Old revision: <email address hidden>
+New revision: <email address hidden>
Index: ec2/ec2test/ server. go server. go' server. go 2013-10-03 12:10:33 +0000 server. go 2013-12-18 14:22:35 +0000
=== modified file 'ec2/ec2test/
--- ec2/ec2test/
+++ ec2/ec2test/
@@ -66,7 +66,8 @@
// instance holds a simulated ec2 instance
type Instance struct {
- seq int
+ seq int
+ dnsNameSet bool
// UserData holds the data that was passed to the RunInstances request
// when the instance was started.
UserData []byte
@@ -550,11 +551,19 @@
func (inst *Instance) ec2instance() ec2.Instance { "%s.testing. invalid" , id) "%s.testing. invalid" , id), "%s.internal. invalid" , id), "8.0.0. %d", inst.seq%256), dress: fmt.Sprintf( "127.0. 0.%d", inst.seq%256),
id := inst.id()
+ // The first time the instance is returned, its DNSName
+ // will be empty. The client should then refresh the instance.
+ var dnsName string
+ if inst.dnsNameSet {
+ dnsName = fmt.Sprintf(
+ } else {
+ inst.dnsNameSet = true
+ }
return ec2.Instance{
InstanceId: id,
InstanceType: inst.instType,
ImageId: inst.imageId,
- DNSName: fmt.Sprintf(
+ DNSName: dnsName,
PrivateDNSName: fmt.Sprintf(
IPAddress: fmt.Sprintf(
PrivateIPAd