File: route53_test.go

package info (click to toggle)
golang-github-adroll-goamz 0.0~git20170225.0.c5d7d9b-1
  • links: PTS, VCS
  • area: main
  • in suites: buster
  • size: 1,520 kB
  • ctags: 2,498
  • sloc: makefile: 41
file content (35 lines) | stat: -rw-r--r-- 1,100 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
package route53_test

import (
	"github.com/AdRoll/goamz/route53"
	. "gopkg.in/check.v1"
	"testing"
)

// Hook up gocheck into the "go test" runner.
func Test(t *testing.T) { TestingT(t) }

// This is a fixure used by a suite of tests
type Route53Suite struct{}

var _ = Suite(&Route53Suite{})

// validate AliasTarget behaviour
func (s *Route53Suite) TestChangeAliasTargetBehavior(c *C) {
	record := route53.ResourceRecordValue{Value: "127.0.0.1"}
	records := []route53.ResourceRecordValue{record}
	change := route53.Change{}
	change.Action = "CREATE"
	change.Name = "test.localdomain"
	change.Type = "A"
	change.TTL = 300
	change.Values = records
	alias_target := route53.AliasTarget{HostedZoneId: "WIOJWAOFIEFAJ", DNSName: "test.localdomain"}
	// AliasTarget should be a nil pointer by default
	c.Assert(change.AliasTarget, IsNil)
	// AliasTarget pass by ref
	change.AliasTarget = &alias_target
	c.Assert(change.AliasTarget.HostedZoneId, Equals, "WIOJWAOFIEFAJ")
	c.Assert(change.AliasTarget.DNSName, Equals, "test.localdomain")
	c.Assert(change.AliasTarget.EvaluateTargetHealth, Equals, false)
}