-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathdomaintest.go
43 lines (35 loc) · 1012 Bytes
/
domaintest.go
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
36
37
38
39
40
41
42
43
package smoketest
import (
"log"
"github.com/dapixio/stress-testing/simulate"
)
// TestBadDomains tests an array of bad addresses from testdata.go to make sure they fail on regaddress
func TestBadDomains() {
log.Println("********* START: TestBadAddresses")
var (
failedCount int = 0
domainList string
)
// create keys for the owner and users
newOwner, _, _, err := simulate.NewOrg(1)
if err != nil {
return
}
// Test characters in the IllegalCharSet
for i := 0; i < len(IllegalCharSet); i++ {
badDomain := RandomString(5) + string(IllegalCharSet[i]) + RandomString(5)
_, err := simulate.RegDomain(newOwner, badDomain)
//log.Println("Register domain failed: ", badDomain)
if err == nil {
//log.Println("Error: ", err.Error())
failedCount++
domainList = domainList + " " + badDomain
}
}
if failedCount > 0 {
log.Println("********* ERROR: Bad domains successfully registered: " + domainList)
} else {
log.Println("********* PASS: TestBadAddresses")
}
return
}