TRANSIP: Fixed integration tests: Edge cases and TXT records fixed#2673
Conversation
- Remove slashes on quoted strings - Add A records to integration tests which were missing a base record
Instead of deleting the whole record set first and recreating it after. Now the New and Old record set get's compared and only new records get created, old records get removed.
changes will not cause issues
models/slashes_test.go
Outdated
|
|
||
| data := [][]string{ | ||
| { | ||
| "quote\"d", "quote\"d", |
There was a problem hiding this comment.
These would be more clear if they were quoted using backticks
There was a problem hiding this comment.
fixed. I didn't know backticks would be literals (with backslash escape sequences). I did the same for the regex to make it more readable
models/slashes.go
Outdated
| ) | ||
|
|
||
| func RemoveSlashes(s string) string { | ||
| m := regexp.MustCompile("(?:\\\\(\\\\)+)|(?:\\\\)") |
There was a problem hiding this comment.
MustCompile should be at the global level.
removeSlashesRE := regexp.MustCompile("(?:\\\\(\\\\)+)|(?:\\\\)")
func RemoveSlashes...
return removeSlashesRE.ReplaceAllStrings(s, "$1")
There was a problem hiding this comment.
Ok, done. Go didn't accept removeSlashesRE := regexp.MustCompile("(?:\\\\(\\\\)+)|(?:\\\\)"). But did accept var removeSlashesRE = regexp.MustCompile("(?:\\\\(\\\\)+)|(?:\\\\)")
providers/transip/transipProvider.go
Outdated
| return fmt.Sprintf("%d %d %d %s", rc.SrvPriority, rc.SrvWeight, rc.SrvPort, rc.GetTargetField()) | ||
| default: | ||
| return models.StripQuotes(rc.GetTargetCombined()) | ||
| return models.RemoveSlashes(models.StripQuotes(rc.GetTargetCombined())) |
There was a problem hiding this comment.
Is models.RemoveSlashes() only needed to TXT records? If so, move that to a case "TXT" statement.
There was a problem hiding this comment.
I believe so... added it.
models/slashes.go
Outdated
| @@ -0,0 +1,10 @@ | |||
| package models | |||
There was a problem hiding this comment.
Please move this to providers/transip. While this function seems re-usable by other providers, I'd rather have each provider be independent as much as possible.
There was a problem hiding this comment.
My thinking was that I couldn't be the only one with these issues. But I made it local to transip as per request.
|
All passed! Merging. |
|
Thanks! |
…2673) Co-authored-by: Tom Limoncelli <[email protected]>
What
Fixes integration tests for trans IP. Fixes #2670 and fixes #2330