()
| 214 | } |
| 215 | |
| 216 | func init() { |
| 217 | Before("", func() { |
| 218 | // randomize temporary test domain name |
| 219 | World["$domain"] = fmt.Sprintf("example%s.com", uniqueReference()) |
| 220 | }) |
| 221 | |
| 222 | After("", func() { |
| 223 | delete(World, "$domain") |
| 224 | delete(World, "$delegationSet") |
| 225 | if len(cleanupIds) > 0 { |
| 226 | // cleanup |
| 227 | r53 := getService() |
| 228 | for _, id := range cleanupIds { |
| 229 | cleanupDomain(r53, id) |
| 230 | } |
| 231 | cleanupIds = []string{} |
| 232 | } |
| 233 | if len(cleanupDSIds) > 0 { |
| 234 | // cleanup |
| 235 | r53 := getService() |
| 236 | for _, id := range cleanupDSIds { |
| 237 | cleanupReusableDelegationSet(r53, id) |
| 238 | } |
| 239 | cleanupDSIds = []string{} |
| 240 | } |
| 241 | }) |
| 242 | |
| 243 | Given(`^I have a domain "(.+?)"$`, func(name string) { |
| 244 | name = domain(name) |
| 245 | // create a test domain |
| 246 | r53 := getService() |
| 247 | callerReference := uniqueReference() |
| 248 | req := route53.CreateHostedZoneInput{ |
| 249 | CallerReference: &callerReference, |
| 250 | Name: &name, |
| 251 | } |
| 252 | resp, err := r53.CreateHostedZone(context.Background(), &req) |
| 253 | fatalIfErr(err) |
| 254 | cleanupIds = append(cleanupIds, *resp.HostedZone.Id) |
| 255 | }) |
| 256 | |
| 257 | Given(`^I have a delegation set$`, func() { |
| 258 | r53 := getService() |
| 259 | callerReference := uniqueReference() |
| 260 | req := route53.CreateReusableDelegationSetInput{ |
| 261 | CallerReference: &callerReference, |
| 262 | } |
| 263 | resp, err := r53.CreateReusableDelegationSet(context.Background(), &req) |
| 264 | fatalIfErr(err) |
| 265 | id := *resp.DelegationSet.Id |
| 266 | World["$delegationSet"] = id |
| 267 | cleanupDSIds = append(cleanupDSIds, id) |
| 268 | }) |
| 269 | |
| 270 | When(`^I run "(.+?)"$`, func(cmd string) { |
| 271 | cmd = replaceMagics(cmd) |
| 272 | args := safeSplit(cmd) |
| 273 | if os.Getenv("COVERAGE") != "" { |
nothing calls this directly
no test coverage detected