PageRenderTime 23ms queryTime 56ms sortTime 0ms getByIdsTime 71ms findMatchingLines 36ms

100+ results results for '*testing.T randomstring' (23 ms)

Not the results you expected?
db_test.go https://gitlab.com/Blueprint-Marketing/syncthing | Go | 1886 lines
                    
35	r := rand.New(rand.NewSource(int64(seed)))
                    
36	return randomString(r, n)
                    
37}
                    
39type dbHarness struct {
                    
40	t *testing.T
                    
41
                    
48
                    
49func newDbHarnessWopt(t *testing.T, o *opt.Options) *dbHarness {
                    
50	h := new(dbHarness)
                    
54
                    
55func newDbHarness(t *testing.T) *dbHarness {
                    
56	return newDbHarnessWopt(t, &opt.Options{})
                    
58
                    
59func (h *dbHarness) init(t *testing.T, o *opt.Options) {
                    
60	h.t = t
                    
                
db_test.go https://gitlab.com/akomba/ether-bot-wallet | Go | 2205 lines
                    
40	r := rand.New(rand.NewSource(int64(seed)))
                    
41	return randomString(r, n)
                    
42}
                    
44type dbHarness struct {
                    
45	t *testing.T
                    
46
                    
53
                    
54func newDbHarnessWopt(t *testing.T, o *opt.Options) *dbHarness {
                    
55	h := new(dbHarness)
                    
59
                    
60func newDbHarness(t *testing.T) *dbHarness {
                    
61	return newDbHarnessWopt(t, &opt.Options{})
                    
63
                    
64func (h *dbHarness) init(t *testing.T, o *opt.Options) {
                    
65	h.t = t
                    
                
db_test.go https://gitlab.com/github-cloud-corporation/coreos-baremetal | Go | 2194 lines
                    
40	r := rand.New(rand.NewSource(int64(seed)))
                    
41	return randomString(r, n)
                    
42}
                    
44type dbHarness struct {
                    
45	t *testing.T
                    
46
                    
53
                    
54func newDbHarnessWopt(t *testing.T, o *opt.Options) *dbHarness {
                    
55	h := new(dbHarness)
                    
59
                    
60func newDbHarness(t *testing.T) *dbHarness {
                    
61	return newDbHarnessWopt(t, &opt.Options{})
                    
63
                    
64func (h *dbHarness) init(t *testing.T, o *opt.Options) {
                    
65	h.t = t
                    
                
db_test.go https://gitlab.com/admin-github-cloud/coreos-baremetal | Go | 2194 lines
                    
40	r := rand.New(rand.NewSource(int64(seed)))
                    
41	return randomString(r, n)
                    
42}
                    
44type dbHarness struct {
                    
45	t *testing.T
                    
46
                    
53
                    
54func newDbHarnessWopt(t *testing.T, o *opt.Options) *dbHarness {
                    
55	h := new(dbHarness)
                    
59
                    
60func newDbHarness(t *testing.T) *dbHarness {
                    
61	return newDbHarnessWopt(t, &opt.Options{})
                    
63
                    
64func (h *dbHarness) init(t *testing.T, o *opt.Options) {
                    
65	h.t = t
                    
                
db_test.go https://gitlab.com/shinvdu/syncthing | Go | 2213 lines
                    
43	r := rand.New(rand.NewSource(int64(seed)))
                    
44	return randomString(r, n)
                    
45}
                    
46
                    
47func testingLogger(t *testing.T) func(log string) {
                    
48	return func(log string) {
                    
52
                    
53func testingPreserveOnFailed(t *testing.T) func() (preserve bool, err error) {
                    
54	return func() (preserve bool, err error) {
                    
60type dbHarness struct {
                    
61	t *testing.T
                    
62
                    
69
                    
70func newDbHarnessWopt(t *testing.T, o *opt.Options) *dbHarness {
                    
71	h := new(dbHarness)
                    
                
compute.go https://gitlab.com/unofficial-mirrors/openshift-origin | Go | 861 lines
                    
34// will be returned if the floating IP was unable to be associated.
                    
35func AssociateFloatingIP(t *testing.T, client *gophercloud.ServiceClient, floatingIP *floatingips.FloatingIP, server *servers.Server) error {
                    
36	associateOpts := floatingips.AssociateOpts{
                    
51// was unable to be associated.
                    
52func AssociateFloatingIPWithFixedIP(t *testing.T, client *gophercloud.ServiceClient, floatingIP *floatingips.FloatingIP, server *servers.Server, fixedIP string) error {
                    
53	associateOpts := floatingips.AssociateOpts{
                    
69// An error will be returned if a server was unable to be created.
                    
70func CreateBootableVolumeServer(t *testing.T, client *gophercloud.ServiceClient, blockDevices []bootfromvolume.BlockDevice) (*servers.Server, error) {
                    
71	if testing.Short() {
                    
86
                    
87	name := tools.RandomString("ACPTTEST", 16)
                    
88	t.Logf("Attempting to create bootable volume server: %s", name)
                    
122// a default rule was unable to be created.
                    
123func CreateDefaultRule(t *testing.T, client *gophercloud.ServiceClient) (dsr.DefaultRule, error) {
                    
124	createOpts := dsr.CreateOpts{
                    
                
db_test.go https://gitlab.com/0072016/syncthing | Go | 2213 lines
                    
43	r := rand.New(rand.NewSource(int64(seed)))
                    
44	return randomString(r, n)
                    
45}
                    
46
                    
47func testingLogger(t *testing.T) func(log string) {
                    
48	return func(log string) {
                    
52
                    
53func testingPreserveOnFailed(t *testing.T) func() (preserve bool, err error) {
                    
54	return func() (preserve bool, err error) {
                    
60type dbHarness struct {
                    
61	t *testing.T
                    
62
                    
69
                    
70func newDbHarnessWopt(t *testing.T, o *opt.Options) *dbHarness {
                    
71	h := new(dbHarness)
                    
                
dao_test.go https://gitlab.com/e0/harbor | Go | 724 lines
                    
143
                    
144func TestRegister(t *testing.T) {
                    
145
                    
175
                    
176func TestUserExists(t *testing.T) {
                    
177	var exists bool
                    
203
                    
204func TestLoginByUserName(t *testing.T) {
                    
205
                    
226
                    
227func TestLoginByEmail(t *testing.T) {
                    
228
                    
250
                    
251func TestGetUser(t *testing.T) {
                    
252	queryUser := models.User{
                    
                
handshake_messages_test.go https://gitlab.com/OBSERVER-DLL/go | Go | 262 lines
                    
34
                    
35func TestMarshalUnmarshal(t *testing.T) {
                    
36	rand := rand.New(rand.NewSource(0))
                    
82
                    
83func TestFuzz(t *testing.T) {
                    
84	rand := rand.New(rand.NewSource(0))
                    
104
                    
105func randomString(n int, rand *rand.Rand) string {
                    
106	b := randomBytes(n, rand)
                    
123	if rand.Intn(10) > 5 {
                    
124		m.serverName = randomString(rand.Intn(255), rand)
                    
125	}
                    
142	for i := range m.alpnProtocols {
                    
143		m.alpnProtocols[i] = randomString(rand.Intn(20)+1, rand)
                    
144	}
                    
                
handshake_messages_test.go https://gitlab.com/lobl.pavel/gcc-6.2.0 | Go | 262 lines
                    
34
                    
35func TestMarshalUnmarshal(t *testing.T) {
                    
36	rand := rand.New(rand.NewSource(0))
                    
82
                    
83func TestFuzz(t *testing.T) {
                    
84	rand := rand.New(rand.NewSource(0))
                    
104
                    
105func randomString(n int, rand *rand.Rand) string {
                    
106	b := randomBytes(n, rand)
                    
123	if rand.Intn(10) > 5 {
                    
124		m.serverName = randomString(rand.Intn(255), rand)
                    
125	}
                    
142	for i := range m.alpnProtocols {
                    
143		m.alpnProtocols[i] = randomString(rand.Intn(20)+1, rand)
                    
144	}
                    
                
handshake_messages_test.go https://gitlab.com/adotout/gcc | Go | 465 lines
                    
39
                    
40func TestMarshalUnmarshal(t *testing.T) {
                    
41	rand := rand.New(rand.NewSource(time.Now().UnixNano()))
                    
87
                    
88func TestFuzz(t *testing.T) {
                    
89	rand := rand.New(rand.NewSource(0))
                    
109
                    
110func randomString(n int, rand *rand.Rand) string {
                    
111	b := randomBytes(n, rand)
                    
129	if rand.Intn(10) > 5 {
                    
130		m.serverName = randomString(rand.Intn(255), rand)
                    
131		for strings.HasSuffix(m.serverName, ".") {
                    
155	for i := 0; i < rand.Intn(5); i++ {
                    
156		m.alpnProtocols = append(m.alpnProtocols, randomString(rand.Intn(20)+1, rand))
                    
157	}
                    
                
helpers_linux_test.go https://gitlab.com/Lin0x/oz | Go | 264 lines
                    
26
                    
27func Test_NetInterfaceNameValid(t *testing.T) {
                    
28	for _, tt := range ifcNameTests {
                    
52	{testLink{name: "ifc03", linkType: "dummy"},
                    
53		LinkOptions{MacAddr: "fa:de:b0:99:52:1c"}, "randomstring",
                    
54		nil},
                    
56
                    
57func Test_FindInterfaceByMacAddress(t *testing.T) {
                    
58	for _, tt := range ifcMacTests {
                    
125
                    
126func Test_DockerPidByName(t *testing.T) {
                    
127	for _, tt := range dockerPidTests {
                    
204
                    
205func Test_NetNsHandle(t *testing.T) {
                    
206	for _, tt := range netNsTests {
                    
                
session_test.go https://gitlab.com/tamasd/ab | Go | 130 lines
                    
39
                    
40func randomString(length int) string {
                    
41	buf := make([]byte, length)
                    
53
                    
54func TestEncDec(t *testing.T) {
                    
55	Convey("Tests encoding and decoding the cookie data", t, func() {
                    
70
                    
71func TestHTTPScenario(t *testing.T) {
                    
72	Convey("Given a simple HTTP scenario", t, func() {
                    
103
                    
104		data := randomString(128)
                    
105
                    
                
fixtures.go https://gitlab.com/shiphitchcock3/kubernetes | Go | 451 lines
                    
66// on the test handler mux that responds with a `Find` response.
                    
67func HandleFindSuccessfully(t *testing.T, output string) {
                    
68	th.Mux.HandleFunc("/stacks/hello_world/resources", func(w http.ResponseWriter, r *http.Request) {
                    
130// on the test handler mux that responds with a `List` response.
                    
131func HandleListSuccessfully(t *testing.T, output string) {
                    
132	th.Mux.HandleFunc("/stacks/hello_world/49181cd6-169a-4130-9455-31185bbfc5bf/resources", func(w http.ResponseWriter, r *http.Request) {
                    
200// on the test handler mux that responds with a `Get` response.
                    
201func HandleGetSuccessfully(t *testing.T, output string) {
                    
202	th.Mux.HandleFunc("/stacks/teststack/0b1771bd-9336-4f2b-ae86-a80f971faf1e/resources/wordpress_instance", func(w http.ResponseWriter, r *http.Request) {
                    
229// on the test handler mux that responds with a `Metadata` response.
                    
230func HandleMetadataSuccessfully(t *testing.T, output string) {
                    
231	th.Mux.HandleFunc("/stacks/teststack/0b1771bd-9336-4f2b-ae86-a80f971faf1e/resources/wordpress_instance/metadata", func(w http.ResponseWriter, r *http.Request) {
                    
244	"OS::Nova::Server",
                    
245	"OS::Heat::RandomString",
                    
246	"OS::Swift::Container",
                    
                
handshake_messages_test.go https://gitlab.com/lirao/azure-sdk-for-go | Go | 246 lines
                    
34
                    
35func TestMarshalUnmarshal(t *testing.T) {
                    
36	rand := rand.New(rand.NewSource(0))
                    
82
                    
83func TestFuzz(t *testing.T) {
                    
84	rand := rand.New(rand.NewSource(0))
                    
104
                    
105func randomString(n int, rand *rand.Rand) string {
                    
106	b := randomBytes(n, rand)
                    
123	if rand.Intn(10) > 5 {
                    
124		m.serverName = randomString(rand.Intn(255), rand)
                    
125	}
                    
158		for i := 0; i < n; i++ {
                    
159			m.nextProtos[i] = randomString(20, rand)
                    
160		}
                    
                
servers_test.go https://gitlab.com/JamesClonk/machine | Go | 450 lines
                    
17
                    
18func TestListServers(t *testing.T) {
                    
19	client, err := newClient()
                    
64
                    
65func createServer(t *testing.T, client *gophercloud.ServiceClient, choices *ComputeChoices) (*servers.Server, error) {
                    
66	if testing.Short() {
                    
94
                    
95	name := tools.RandomString("ACPTTEST", 16)
                    
96	t.Logf("Attempting to create server: %s\n", name)
                    
117
                    
118func TestCreateDestroyServer(t *testing.T) {
                    
119	choices, err := ComputeChoicesFromEnv()
                    
142
                    
143func TestUpdateServer(t *testing.T) {
                    
144	client, err := newClient()
                    
                
random_data_test.go https://gitlab.com/ezeql/go-randomdata | Go | 257 lines
                    
8
                    
9func TestRandomStringDigits(t *testing.T) {
                    
10	t.Log("TestRandomStringDigits")
                    
28
                    
29func TestFirstName(t *testing.T) {
                    
30	t.Log("TestFirstName")
                    
48
                    
49func TestLastName(t *testing.T) {
                    
50	t.Log("TestLastName")
                    
57
                    
58func TestFullName(t *testing.T) {
                    
59	t.Log("TestFullName")
                    
102
                    
103func TestEmail(t *testing.T) {
                    
104	t.Log("TestEmail")
                    
                
bulk_processor_test.go https://gitlab.com/vantruong/GolangRestAPI | Go | 421 lines
                    
14
                    
15func TestBulkProcessorDefaults(t *testing.T) {
                    
16	client := setupTestClientAndCreateIndex(t)
                    
41
                    
42func TestBulkProcessorCommitOnBulkActions(t *testing.T) {
                    
43	//client := setupTestClientAndCreateIndexAndLog(t, SetTraceLog(log.New(os.Stdout, "", 0)))
                    
64
                    
65func TestBulkProcessorCommitOnBulkSize(t *testing.T) {
                    
66	//client := setupTestClientAndCreateIndexAndLog(t, SetTraceLog(log.New(os.Stdout, "", 0)))
                    
87
                    
88func TestBulkProcessorBasedOnFlushInterval(t *testing.T) {
                    
89	//client := setupTestClientAndCreateIndexAndLog(t, SetTraceLog(log.New(os.Stdout, "", 0)))
                    
126	for i := 1; i <= numDocs; i++ {
                    
127		tweet := tweet{User: "olivere", Message: fmt.Sprintf("%d. %s", i, randomString(rand.Intn(64)))}
                    
128		request := NewBulkIndexRequest().Index(testIndexName).Type("tweet").Id(fmt.Sprintf("%d", i)).Doc(tweet)
                    
                
lbaas_v2.go https://gitlab.com/unofficial-mirrors/openshift-origin | Go | 282 lines
                    
21// be created.
                    
22func CreateListener(t *testing.T, client *gophercloud.ServiceClient, lb *loadbalancers.LoadBalancer) (*listeners.Listener, error) {
                    
23	listenerName := tools.RandomString("TESTACCT-", 8)
                    
50// subnet. An error will be returned if the loadbalancer could not be created.
                    
51func CreateLoadBalancer(t *testing.T, client *gophercloud.ServiceClient, subnetID string) (*loadbalancers.LoadBalancer, error) {
                    
52	lbName := tools.RandomString("TESTACCT-", 8)
                    
80// weight. An error will be returned if the member could not be created.
                    
81func CreateMember(t *testing.T, client *gophercloud.ServiceClient, lb *loadbalancers.LoadBalancer, pool *pools.Pool, subnetID, subnetCIDR string) (*pools.Member, error) {
                    
82	memberName := tools.RandomString("TESTACCT-", 8)
                    
117// An error will be returned if the monitor could not be created.
                    
118func CreateMonitor(t *testing.T, client *gophercloud.ServiceClient, lb *loadbalancers.LoadBalancer, pool *pools.Pool) (*monitors.Monitor, error) {
                    
119	monitorName := tools.RandomString("TESTACCT-", 8)
                    
148// created.
                    
149func CreatePool(t *testing.T, client *gophercloud.ServiceClient, lb *loadbalancers.LoadBalancer) (*pools.Pool, error) {
                    
150	poolName := tools.RandomString("TESTACCT-", 8)
                    
                
db_test.go git://github.com/bradfitz/camlistore.git | Go | 2666 lines
                    
40	r := rand.New(rand.NewSource(int64(seed)))
                    
41	return randomString(r, n)
                    
42}
                    
44type dbHarness struct {
                    
45	t *testing.T
                    
46
                    
53
                    
54func newDbHarnessWopt(t *testing.T, o *opt.Options) *dbHarness {
                    
55	h := new(dbHarness)
                    
59
                    
60func newDbHarness(t *testing.T) *dbHarness {
                    
61	return newDbHarnessWopt(t, &opt.Options{})
                    
63
                    
64func (h *dbHarness) init(t *testing.T, o *opt.Options) {
                    
65	h.t = t
                    
                
routes_test.go https://gitlab.com/CORP-RESELLER/cf-distribution | Go | 355 lines
                    
30// This may go away as the application structure comes together.
                    
31func TestRouter(t *testing.T) {
                    
32	testCases := []routeTestCase{
                    
178
                    
179func TestRouterWithPathTraversals(t *testing.T) {
                    
180	testCases := []routeTestCase{
                    
199
                    
200func TestRouterWithBadCharacters(t *testing.T) {
                    
201	if testing.Short() {
                    
225				RouteName:  RouteNameTags,
                    
226				RequestURI: fmt.Sprintf("/v2/%v/%v/tags/list", randomString(10), randomString(10)),
                    
227				StatusCode: http.StatusNotFound,
                    
233
                    
234func checkTestRouter(t *testing.T, testCases []routeTestCase, prefix string, deeplyEqual bool) {
                    
235	router := RouterWithPrefix(prefix)
                    
                
extensions.go https://gitlab.com/unofficial-mirrors/openshift-origin | Go | 173 lines
                    
18// returned
                    
19func CreateUploadImage(t *testing.T, client *gophercloud.ServiceClient, volume *volumes.Volume) (volumeactions.VolumeImage, error) {
                    
20	if testing.Short() {
                    
23
                    
24	imageName := tools.RandomString("ACPTTEST", 16)
                    
25	uploadImageOpts := volumeactions.UploadImageOpts{
                    
48// if the deletion request failed.
                    
49func DeleteUploadedImage(t *testing.T, client *gophercloud.ServiceClient, imageName string) error {
                    
50	if testing.Short() {
                    
72// returned if the attachment failed.
                    
73func CreateVolumeAttach(t *testing.T, client *gophercloud.ServiceClient, volume *volumes.Volume, server *servers.Server) error {
                    
74	if testing.Short() {
                    
100// if the reservation failed.
                    
101func CreateVolumeReserve(t *testing.T, client *gophercloud.ServiceClient, volume *volumes.Volume) error {
                    
102	if testing.Short() {
                    
                
node_test.go https://gitlab.com/JamesClonk/machine | Go | 175 lines
                    
18
                    
19func TestNodes(t *testing.T) {
                    
20	client := setup(t)
                    
41
                    
42func findServer(t *testing.T) string {
                    
43	var serverIP string
                    
74		opts := &servers.CreateOpts{
                    
75			Name:       tools.RandomString("lb_test_", 5),
                    
76			ImageRef:   imageRef,
                    
93
                    
94func addNodes(t *testing.T, client *gophercloud.ServiceClient, lbID int, serverIP string) int {
                    
95	opts := nodes.CreateOpts{
                    
122
                    
123func listNodes(t *testing.T, client *gophercloud.ServiceClient, lbID int) {
                    
124	err := nodes.List(client, lbID, nil).EachPage(func(page pagination.Page) (bool, error) {
                    
                
handshake_messages_test.go https://bitbucket.org/pizzafactory/pf-gcc.git | Go | 202 lines
                    
31
                    
32func TestMarshalUnmarshal(t *testing.T) {
                    
33	rand := rand.New(rand.NewSource(0))
                    
73
                    
74func TestFuzz(t *testing.T) {
                    
75	rand := rand.New(rand.NewSource(0))
                    
95
                    
96func randomString(n int, rand *rand.Rand) string {
                    
97	b := randomBytes(n, rand)
                    
114	if rand.Intn(10) > 5 {
                    
115		m.serverName = randomString(rand.Intn(255), rand)
                    
116	}
                    
140		for i := 0; i < n; i++ {
                    
141			m.nextProtos[i] = randomString(20, rand)
                    
142		}
                    
                
routes_test.go https://gitlab.com/asimpletune/distribution | Go | 363 lines
                    
30// This may go away as the application structure comes together.
                    
31func TestRouter(t *testing.T) {
                    
32	testCases := []routeTestCase{
                    
186
                    
187func TestRouterWithPathTraversals(t *testing.T) {
                    
188	testCases := []routeTestCase{
                    
207
                    
208func TestRouterWithBadCharacters(t *testing.T) {
                    
209	if testing.Short() {
                    
233				RouteName:  RouteNameTags,
                    
234				RequestURI: fmt.Sprintf("/v2/%v/%v/tags/list", randomString(10), randomString(10)),
                    
235				StatusCode: http.StatusNotFound,
                    
241
                    
242func checkTestRouter(t *testing.T, testCases []routeTestCase, prefix string, deeplyEqual bool) {
                    
243	router := RouterWithPrefix(prefix)
                    
                
handshake_messages_test.go https://gitlab.com/JamesClonk/machine | Go | 246 lines
                    
34
                    
35func TestMarshalUnmarshal(t *testing.T) {
                    
36	rand := rand.New(rand.NewSource(0))
                    
82
                    
83func TestFuzz(t *testing.T) {
                    
84	rand := rand.New(rand.NewSource(0))
                    
104
                    
105func randomString(n int, rand *rand.Rand) string {
                    
106	b := randomBytes(n, rand)
                    
123	if rand.Intn(10) > 5 {
                    
124		m.serverName = randomString(rand.Intn(255), rand)
                    
125	}
                    
158		for i := 0; i < n; i++ {
                    
159			m.nextProtos[i] = randomString(20, rand)
                    
160		}
                    
                
file_test.go https://gitlab.com/unofficial-mirrors/mattermost-platform | Go | 163 lines
                    
19
                    
20func TestGeneratePublicLinkHash(t *testing.T) {
                    
21	filename1 := model.NewId() + "/" + model.NewRandomString(16) + ".txt"
                    
21	filename1 := model.NewId() + "/" + model.NewRandomString(16) + ".txt"
                    
22	filename2 := model.NewId() + "/" + model.NewRandomString(16) + ".txt"
                    
23	salt1 := model.NewRandomString(32)
                    
23	salt1 := model.NewRandomString(32)
                    
24	salt2 := model.NewRandomString(32)
                    
25
                    
42
                    
43func TestDoUploadFile(t *testing.T) {
                    
44	th := Setup()
                    
109
                    
110func TestGetInfoForFilename(t *testing.T) {
                    
111	th := Setup().InitBasic()
                    
                
routes_test.go https://gitlab.com/vectorci/cf-distribution | Go | 355 lines
                    
30// This may go away as the application structure comes together.
                    
31func TestRouter(t *testing.T) {
                    
32	testCases := []routeTestCase{
                    
178
                    
179func TestRouterWithPathTraversals(t *testing.T) {
                    
180	testCases := []routeTestCase{
                    
199
                    
200func TestRouterWithBadCharacters(t *testing.T) {
                    
201	if testing.Short() {
                    
225				RouteName:  RouteNameTags,
                    
226				RequestURI: fmt.Sprintf("/v2/%v/%v/tags/list", randomString(10), randomString(10)),
                    
227				StatusCode: http.StatusNotFound,
                    
233
                    
234func checkTestRouter(t *testing.T, testCases []routeTestCase, prefix string, deeplyEqual bool) {
                    
235	router := RouterWithPrefix(prefix)
                    
                
handshake_messages_test.go https://gitlab.com/4144/gcc | Go | 482 lines
                    
40
                    
41func TestMarshalUnmarshal(t *testing.T) {
                    
42	rand := rand.New(rand.NewSource(time.Now().UnixNano()))
                    
88
                    
89func TestFuzz(t *testing.T) {
                    
90	rand := rand.New(rand.NewSource(0))
                    
110
                    
111func randomString(n int, rand *rand.Rand) string {
                    
112	b := randomBytes(n, rand)
                    
133	if rand.Intn(10) > 5 {
                    
134		m.serverName = randomString(rand.Intn(255), rand)
                    
135		for strings.HasSuffix(m.serverName, ".") {
                    
159	for i := 0; i < rand.Intn(5); i++ {
                    
160		m.alpnProtocols = append(m.alpnProtocols, randomString(rand.Intn(20)+1, rand))
                    
161	}
                    
                
client_test.go https://gitlab.com/unofficial-mirrors/openshift-origin | Go | 402 lines
                    
31
                    
32func TestLoggingInspectorWithInspection(t *testing.T) {
                    
33	b := bytes.Buffer{}
                    
45
                    
46func TestLoggingInspectorWithInspectionEmitsErrors(t *testing.T) {
                    
47	b := bytes.Buffer{}
                    
62
                    
63func TestLoggingInspectorWithInspectionRestoresBody(t *testing.T) {
                    
64	b := bytes.Buffer{}
                    
78
                    
79func TestLoggingInspectorByInspecting(t *testing.T) {
                    
80	b := bytes.Buffer{}
                    
92
                    
93func TestLoggingInspectorByInspectingEmitsErrors(t *testing.T) {
                    
94	b := bytes.Buffer{}
                    
                
servers_test.go https://gitlab.com/Red54/machine | Go | 217 lines
                    
18
                    
19func createServerKeyPair(t *testing.T, client *gophercloud.ServiceClient) *oskey.KeyPair {
                    
20	name := tools.RandomString("importedkey-", 8)
                    
31
                    
32func createServer(t *testing.T, client *gophercloud.ServiceClient, keyName string) *os.Server {
                    
33	if testing.Short() {
                    
39
                    
40	name := tools.RandomString("Gophercloud-", 8)
                    
41
                    
69
                    
70func logServer(t *testing.T, server *os.Server, index int) {
                    
71	if index == -1 {
                    
94
                    
95func getServer(t *testing.T, client *gophercloud.ServiceClient, server *os.Server) {
                    
96	t.Logf("> servers.Get")
                    
                
domains_test.go https://gitlab.com/github-cloud-corporation/dex | Go | 96 lines
                    
11
                    
12func TestGetDomains(t *testing.T) {
                    
13	domain := reqEnv(t, "MG_DOMAIN")
                    
25
                    
26func TestGetSingleDomain(t *testing.T) {
                    
27	domain := reqEnv(t, "MG_DOMAIN")
                    
47
                    
48func TestGetSingleDomainNotExist(t *testing.T) {
                    
49	domain := reqEnv(t, "MG_DOMAIN")
                    
51	mg := mailgun.NewMailgun(domain, apiKey, "")
                    
52	_, _, _, err := mg.GetSingleDomain(randomString(32, "com.edu.org.")+".com")
                    
53	if err == nil {
                    
64
                    
65func TestAddDeleteDomain(t *testing.T) {
                    
66	// First, we need to add the domain.
                    
                
domains_test.go https://gitlab.com/admin-github-cloud/dex | Go | 96 lines
                    
11
                    
12func TestGetDomains(t *testing.T) {
                    
13	domain := reqEnv(t, "MG_DOMAIN")
                    
25
                    
26func TestGetSingleDomain(t *testing.T) {
                    
27	domain := reqEnv(t, "MG_DOMAIN")
                    
47
                    
48func TestGetSingleDomainNotExist(t *testing.T) {
                    
49	domain := reqEnv(t, "MG_DOMAIN")
                    
51	mg := mailgun.NewMailgun(domain, apiKey, "")
                    
52	_, _, _, err := mg.GetSingleDomain(randomString(32, "com.edu.org.")+".com")
                    
53	if err == nil {
                    
64
                    
65func TestAddDeleteDomain(t *testing.T) {
                    
66	// First, we need to add the domain.
                    
                
lb_test.go https://gitlab.com/JamesClonk/machine | Go | 214 lines
                    
16
                    
17func TestLBs(t *testing.T) {
                    
18	client := setup(t)
                    
43
                    
44func createLB(t *testing.T, client *gophercloud.ServiceClient, count int) []int {
                    
45	ids := []int{}
                    
48		opts := lbs.CreateOpts{
                    
49			Name:     tools.RandomString("test_", 5),
                    
50			Port:     80,
                    
82
                    
83func listLBProtocols(t *testing.T, client *gophercloud.ServiceClient) {
                    
84	err := lbs.ListProtocols(client).EachPage(func(page pagination.Page) (bool, error) {
                    
96
                    
97func listLBAlgorithms(t *testing.T, client *gophercloud.ServiceClient) {
                    
98	err := lbs.ListAlgorithms(client).EachPage(func(page pagination.Page) (bool, error) {
                    
                
node_test.go https://gitlab.com/Red54/machine | Go | 175 lines
                    
18
                    
19func TestNodes(t *testing.T) {
                    
20	client := setup(t)
                    
41
                    
42func findServer(t *testing.T) string {
                    
43	var serverIP string
                    
74		opts := &servers.CreateOpts{
                    
75			Name:       tools.RandomString("lb_test_", 5),
                    
76			ImageRef:   imageRef,
                    
93
                    
94func addNodes(t *testing.T, client *gophercloud.ServiceClient, lbID int, serverIP string) int {
                    
95	opts := nodes.CreateOpts{
                    
122
                    
123func listNodes(t *testing.T, client *gophercloud.ServiceClient, lbID int) {
                    
124	err := nodes.List(client, lbID, nil).EachPage(func(page pagination.Page) (bool, error) {
                    
                
secgroup_test.go https://gitlab.com/unofficial-mirrors/openshift-origin | Go | 137 lines
                    
12
                    
13func TestSecGroupsList(t *testing.T) {
                    
14	client, err := clients.NewComputeV2Client()
                    
33
                    
34func TestSecGroupsCreate(t *testing.T) {
                    
35	client, err := clients.NewComputeV2Client()
                    
46
                    
47func TestSecGroupsUpdate(t *testing.T) {
                    
48	client, err := clients.NewComputeV2Client()
                    
59	updateOpts := secgroups.UpdateOpts{
                    
60		Name:        tools.RandomString("secgroup_", 4),
                    
61		Description: tools.RandomString("dec_", 10),
                    
70
                    
71func TestSecGroupsRuleCreate(t *testing.T) {
                    
72	client, err := clients.NewComputeV2Client()
                    
                
handshake_messages_test.go https://gitlab.com/Red54/machine | Go | 246 lines
                    
34
                    
35func TestMarshalUnmarshal(t *testing.T) {
                    
36	rand := rand.New(rand.NewSource(0))
                    
82
                    
83func TestFuzz(t *testing.T) {
                    
84	rand := rand.New(rand.NewSource(0))
                    
104
                    
105func randomString(n int, rand *rand.Rand) string {
                    
106	b := randomBytes(n, rand)
                    
123	if rand.Intn(10) > 5 {
                    
124		m.serverName = randomString(rand.Intn(255), rand)
                    
125	}
                    
158		for i := 0; i < n; i++ {
                    
159			m.nextProtos[i] = randomString(20, rand)
                    
160		}
                    
                
servers_test.go https://gitlab.com/JamesClonk/machine | Go | 204 lines
                    
18
                    
19func createServerKeyPair(t *testing.T, client *gophercloud.ServiceClient) *oskey.KeyPair {
                    
20	name := tools.RandomString("importedkey-", 8)
                    
31
                    
32func createServer(t *testing.T, client *gophercloud.ServiceClient, keyName string) *os.Server {
                    
33	if testing.Short() {
                    
39
                    
40	name := tools.RandomString("Gophercloud-", 8)
                    
41
                    
69
                    
70func logServer(t *testing.T, server *os.Server, index int) {
                    
71	if index == -1 {
                    
94
                    
95func getServer(t *testing.T, client *gophercloud.ServiceClient, server *os.Server) {
                    
96	t.Logf("> servers.Get")
                    
                
servers_test.go https://gitlab.com/Red54/machine | Go | 478 lines
                    
17
                    
18func TestListServers(t *testing.T) {
                    
19	client, err := newClient()
                    
63
                    
64func createServer(t *testing.T, client *gophercloud.ServiceClient, choices *ComputeChoices) (*servers.Server, error) {
                    
65	if testing.Short() {
                    
96
                    
97	name := tools.RandomString("ACPTTEST", 16)
                    
98	t.Logf("Attempting to create server: %s\n", name)
                    
119
                    
120func TestCreateDestroyServer(t *testing.T) {
                    
121	choices, err := ComputeChoicesFromEnv()
                    
170
                    
171func TestUpdateServer(t *testing.T) {
                    
172	client, err := newClient()
                    
                
servers_test.go https://gitlab.com/unofficial-mirrors/openshift-origin | Go | 523 lines
                    
21
                    
22func TestServersList(t *testing.T) {
                    
23	client, err := clients.NewComputeV2Client()
                    
42
                    
43func TestServersCreateDestroy(t *testing.T) {
                    
44	client, err := clients.NewComputeV2Client()
                    
110
                    
111func TestServersCreateDestroyWithExtensions(t *testing.T) {
                    
112	var extendedServer struct {
                    
140
                    
141func TestServersWithoutImageRef(t *testing.T) {
                    
142	client, err := clients.NewComputeV2Client()
                    
156
                    
157func TestServersUpdate(t *testing.T) {
                    
158	client, err := clients.NewComputeV2Client()
                    
                
layer3.go https://gitlab.com/unofficial-mirrors/openshift-origin | Go | 250 lines
                    
15// will be returned if the creation failed.
                    
16func CreateFloatingIP(t *testing.T, client *gophercloud.ServiceClient, networkID, portID string) (*floatingips.FloatingIP, error) {
                    
17	t.Logf("Attempting to create floating IP on port: %s", portID)
                    
36// creation failed.
                    
37func CreateExternalRouter(t *testing.T, client *gophercloud.ServiceClient) (*routers.Router, error) {
                    
38	var router *routers.Router
                    
43
                    
44	routerName := tools.RandomString("TESTACC-", 8)
                    
45
                    
76// returned if the creation failed.
                    
77func CreateRouter(t *testing.T, client *gophercloud.ServiceClient, networkID string) (*routers.Router, error) {
                    
78	routerName := tools.RandomString("TESTACC-", 8)
                    
108// returned if the operation fails.
                    
109func CreateRouterInterface(t *testing.T, client *gophercloud.ServiceClient, portID, routerID string) (*routers.InterfaceInfo, error) {
                    
110	t.Logf("Attempting to add port %s to router %s", portID, routerID)
                    
                
routes_test.go https://gitlab.com/unofficial-mirrors/openshift-origin | Go | 355 lines
                    
30// This may go away as the application structure comes together.
                    
31func TestRouter(t *testing.T) {
                    
32	testCases := []routeTestCase{
                    
178
                    
179func TestRouterWithPathTraversals(t *testing.T) {
                    
180	testCases := []routeTestCase{
                    
199
                    
200func TestRouterWithBadCharacters(t *testing.T) {
                    
201	if testing.Short() {
                    
225				RouteName:  RouteNameTags,
                    
226				RequestURI: fmt.Sprintf("/v2/%v/%v/tags/list", randomString(10), randomString(10)),
                    
227				StatusCode: http.StatusNotFound,
                    
233
                    
234func checkTestRouter(t *testing.T, testCases []routeTestCase, prefix string, deeplyEqual bool) {
                    
235	router := RouterWithPrefix(prefix)
                    
                
handshake_messages_test.go git://github.com/axw/llgo.git | Go | 262 lines
                    
34
                    
35func TestMarshalUnmarshal(t *testing.T) {
                    
36	rand := rand.New(rand.NewSource(0))
                    
82
                    
83func TestFuzz(t *testing.T) {
                    
84	rand := rand.New(rand.NewSource(0))
                    
104
                    
105func randomString(n int, rand *rand.Rand) string {
                    
106	b := randomBytes(n, rand)
                    
123	if rand.Intn(10) > 5 {
                    
124		m.serverName = randomString(rand.Intn(255), rand)
                    
125	}
                    
142	for i := range m.alpnProtocols {
                    
143		m.alpnProtocols[i] = randomString(rand.Intn(20)+1, rand)
                    
144	}
                    
                
stream_test.go https://gitlab.com/caddy/caddy | Go | 436 lines
                    
21// (see https://github.com/caddyserver/caddy/issues/3556 for use case)
                    
22func TestH2ToH2CStream(t *testing.T) {
                    
23	tester := caddytest.NewTester(t)
                    
148
                    
149func testH2ToH2CStreamServeH2C(t *testing.T) *http.Server {
                    
150	h2s := &http2.Server{}
                    
204// (see https://github.com/caddyserver/caddy/issues/3606 for use case)
                    
205func TestH2ToH1ChunkedResponse(t *testing.T) {
                    
206	tester := caddytest.NewTester(t)
                    
303	// need a large body here to trigger caddy's compression, larger than gzip.miniLength
                    
304	expectedBody, err := GenerateRandomString(1024)
                    
305	if err != nil {
                    
356
                    
357func testH2ToH1ChunkedResponseServeH1(t *testing.T) *http.Server {
                    
358	handler := http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {
                    
                
jenkins_test.go https://gitlab.com/Kravcenko/gojenkins | Go | 178 lines
                    
15
                    
16func TestInit(t *testing.T) {
                    
17	jenkins = CreateJenkins("http://localhost:8080", "admin", "admin")
                    
21
                    
22func TestCreateJobs(t *testing.T) {
                    
23	job1ID := "Job1_test"
                    
38
                    
39func TestCreateNodes(t *testing.T) {
                    
40
                    
57
                    
58func TestCreateBuilds(t *testing.T) {
                    
59	jobs, _ := jenkins.GetAllJobs()
                    
73
                    
74func TestCreateViews(t *testing.T) {
                    
75	list_view, err := jenkins.CreateView("test_list_view", LIST_VIEW)
                    
                
file_test.go https://gitlab.com/ricardo.hernandez/telegraf | Go | 196 lines
                    
22
                    
23func TestFileExistingFile(t *testing.T) {
                    
24	fh := createFile()
                    
42
                    
43func TestFileNewFile(t *testing.T) {
                    
44	s, _ := serializers.NewInfluxSerializer()
                    
62
                    
63func TestFileExistingFiles(t *testing.T) {
                    
64	fh1 := createFile()
                    
87
                    
88func TestFileNewFiles(t *testing.T) {
                    
89	s, _ := serializers.NewInfluxSerializer()
                    
111
                    
112func TestFileBoth(t *testing.T) {
                    
113	fh1 := createFile()
                    
                
handshake_messages_test.go https://github.com/AsherBond/MondocosmOS-Dependencies.git | Go | 206 lines
                    
31
                    
32func TestMarshalUnmarshal(t *testing.T) {
                    
33	rand := rand.New(rand.NewSource(0))
                    
77
                    
78func TestFuzz(t *testing.T) {
                    
79	rand := rand.New(rand.NewSource(0))
                    
99
                    
100func randomString(n int, rand *rand.Rand) string {
                    
101	b := randomBytes(n, rand)
                    
118	if rand.Intn(10) > 5 {
                    
119		m.serverName = randomString(rand.Intn(255), rand)
                    
120	}
                    
144		for i := 0; i < n; i++ {
                    
145			m.nextProtos[i] = randomString(20, rand)
                    
146		}
                    
                
lb_test.go https://gitlab.com/Red54/machine | Go | 214 lines
                    
16
                    
17func TestLBs(t *testing.T) {
                    
18	client := setup(t)
                    
43
                    
44func createLB(t *testing.T, client *gophercloud.ServiceClient, count int) []int {
                    
45	ids := []int{}
                    
48		opts := lbs.CreateOpts{
                    
49			Name:     tools.RandomString("test_", 5),
                    
50			Port:     80,
                    
82
                    
83func listLBProtocols(t *testing.T, client *gophercloud.ServiceClient) {
                    
84	err := lbs.ListProtocols(client).EachPage(func(page pagination.Page) (bool, error) {
                    
96
                    
97func listLBAlgorithms(t *testing.T, client *gophercloud.ServiceClient) {
                    
98	err := lbs.ListAlgorithms(client).EachPage(func(page pagination.Page) (bool, error) {
                    
                
helpers_test.go https://gitlab.com/epicglue/epicglue | Go | 141 lines
                    
31
                    
32func TestRandomString(t *testing.T) {
                    
33	r1 := helpers.RandomString(8)
                    
38
                    
39	r3 := helpers.RandomString(1)
                    
40	assert.Len(t, r3, 1)
                    
60
                    
61func TestFlattenArrayOfStrings(t *testing.T) {
                    
62	assert.Equal(t, "[]", helpers.FlattenArrayOfStrings([]string{}))
                    
72
                    
73func TestStringToInt64(t *testing.T) {
                    
74	assert.Equal(t, helpers.StringToInt64("-9223372036854775808"), int64(-9223372036854775808))
                    
77
                    
78func TestStringToFloat64(t *testing.T) {
                    
79	assert.Equal(t, helpers.StringToFloat64("4.11"), float64(4.11))
                    
                
counter_integration_test.go https://gitlab.com/epicglue/epicglue | Go | 124 lines
                    
31
                    
32	return &user, helpers.RandomString(16)
                    
33}
                    
34
                    
35func TestTooLongKey(t *testing.T) {
                    
36	user, _ := makeTestData()
                    
36	user, _ := makeTestData()
                    
37	key := helpers.RandomString(101)
                    
38
                    
46
                    
47func TestDecimalPoints(t *testing.T) {
                    
48
                    
50
                    
51func TestInc(t *testing.T) {
                    
52	user, key := makeTestData()
                    
                
handshake_messages_test.go https://github.com/vablaya/gopp-cs345.git | Go | 206 lines
                    
31
                    
32func TestMarshalUnmarshal(t *testing.T) {
                    
33	rand := rand.New(rand.NewSource(0))
                    
77
                    
78func TestFuzz(t *testing.T) {
                    
79	rand := rand.New(rand.NewSource(0))
                    
99
                    
100func randomString(n int, rand *rand.Rand) string {
                    
101	b := randomBytes(n, rand)
                    
118	if rand.Intn(10) > 5 {
                    
119		m.serverName = randomString(rand.Intn(255), rand)
                    
120	}
                    
144		for i := 0; i < n; i++ {
                    
145			m.nextProtos[i] = randomString(20, rand)
                    
146		}
                    
                
client_test.go https://gitlab.com/unofficial-mirrors/openshift-origin | Go | 275 lines
                    
15func integrationClient() (*Client, error) {
                    
16	t, err := randomString()
                    
17	if err != nil {
                    
26
                    
27func randomString() (string, error) {
                    
28	b := make([]byte, 16)
                    
37
                    
38func TestTenantModifier(t *testing.T) {
                    
39	c, err := integrationClient()
                    
41
                    
42	ot, _ := randomString()
                    
43
                    
62
                    
63func TestCreate(t *testing.T) {
                    
64	c, err := integrationClient()
                    
                
identity.go https://gitlab.com/unofficial-mirrors/openshift-origin | Go | 186 lines
                    
16// returned if the grant was unsuccessful.
                    
17func AddUserRole(t *testing.T, client *gophercloud.ServiceClient, tenant *tenants.Tenant, user *users.User, role *roles.Role) error {
                    
18	t.Logf("Attempting to grant user %s role %s in tenant %s", user.ID, role.ID, tenant.ID)
                    
33// unable to be created.
                    
34func CreateTenant(t *testing.T, client *gophercloud.ServiceClient, c *tenants.CreateOpts) (*tenants.Tenant, error) {
                    
35	name := tools.RandomString("ACPTTEST", 8)
                    
59// tenant. An error will be returned if the user was unable to be created.
                    
60func CreateUser(t *testing.T, client *gophercloud.ServiceClient, tenant *tenants.Tenant) (*users.User, error) {
                    
61	userName := tools.RandomString("user_", 5)
                    
82// a deferred function.
                    
83func DeleteTenant(t *testing.T, client *gophercloud.ServiceClient, tenantID string) {
                    
84	err := tenants.Delete(client, tenantID).ExtractErr()
                    
93// unsuccessful. This works best when used as a deferred function.
                    
94func DeleteUser(t *testing.T, client *gophercloud.ServiceClient, user *users.User) {
                    
95	t.Logf("Attempting to delete user: %s", user.Name)
                    
                
fixtures.go https://gitlab.com/Red54/machine | Go | 451 lines
                    
66// on the test handler mux that responds with a `Find` response.
                    
67func HandleFindSuccessfully(t *testing.T, output string) {
                    
68	th.Mux.HandleFunc("/stacks/hello_world/resources", func(w http.ResponseWriter, r *http.Request) {
                    
130// on the test handler mux that responds with a `List` response.
                    
131func HandleListSuccessfully(t *testing.T, output string) {
                    
132	th.Mux.HandleFunc("/stacks/hello_world/49181cd6-169a-4130-9455-31185bbfc5bf/resources", func(w http.ResponseWriter, r *http.Request) {
                    
200// on the test handler mux that responds with a `Get` response.
                    
201func HandleGetSuccessfully(t *testing.T, output string) {
                    
202	th.Mux.HandleFunc("/stacks/teststack/0b1771bd-9336-4f2b-ae86-a80f971faf1e/resources/wordpress_instance", func(w http.ResponseWriter, r *http.Request) {
                    
229// on the test handler mux that responds with a `Metadata` response.
                    
230func HandleMetadataSuccessfully(t *testing.T, output string) {
                    
231	th.Mux.HandleFunc("/stacks/teststack/0b1771bd-9336-4f2b-ae86-a80f971faf1e/resources/wordpress_instance/metadata", func(w http.ResponseWriter, r *http.Request) {
                    
244	"OS::Nova::Server",
                    
245	"OS::Heat::RandomString",
                    
246	"OS::Swift::Container",
                    
                
env_test.go https://github.com/dotcloud/docker.git | Go | 313 lines
                    
26
                    
27func TestEnvLenDup(t *testing.T) {
                    
28	env := &Env{
                    
38
                    
39func TestNewJob(t *testing.T) {
                    
40	job := mkJob(t, "dummy", "--level=awesome")
                    
51
                    
52func TestSetenv(t *testing.T) {
                    
53	job := mkJob(t, "dummy")
                    
84
                    
85func TestSetenvInt(t *testing.T) {
                    
86	job := mkJob(t, "dummy")
                    
153	for i := 0; i < l; i++ {
                    
154		t := [2]string{testutils.RandomString(5), testutils.RandomString(20)}
                    
155		res[i] = t
                    
                
secgroup_test.go https://gitlab.com/JamesClonk/machine | Go | 177 lines
                    
15
                    
16func TestSecGroups(t *testing.T) {
                    
17	client, err := newClient()
                    
25
                    
26	newName := tools.RandomString("secgroup_", 5)
                    
27	updateSecGroup(t, client, groupID, newName)
                    
43
                    
44func createSecGroup(t *testing.T, client *gophercloud.ServiceClient) string {
                    
45	opts := secgroups.CreateOpts{
                    
45	opts := secgroups.CreateOpts{
                    
46		Name:        tools.RandomString("secgroup_", 5),
                    
47		Description: "something",
                    
57
                    
58func listSecGroups(t *testing.T, client *gophercloud.ServiceClient) {
                    
59	err := secgroups.List(client).EachPage(func(page pagination.Page) (bool, error) {
                    
                
extensions.go https://gitlab.com/unofficial-mirrors/openshift-origin | Go | 142 lines
                    
16// returned if the creation failed.
                    
17func CreateExternalNetwork(t *testing.T, client *gophercloud.ServiceClient) (*networks.Network, error) {
                    
18	networkName := tools.RandomString("TESTACC-", 8)
                    
46// attached. An error will be returned if the port could not be created.
                    
47func CreatePortWithSecurityGroup(t *testing.T, client *gophercloud.ServiceClient, networkID, subnetID, secGroupID string) (*ports.Port, error) {
                    
48	portName := tools.RandomString("TESTACC-", 8)
                    
72// An error will be returned if one was failed to be created.
                    
73func CreateSecurityGroup(t *testing.T, client *gophercloud.ServiceClient) (*groups.SecGroup, error) {
                    
74	secGroupName := tools.RandomString("TESTACC-", 8)
                    
94// An error will be returned if one was failed to be created.
                    
95func CreateSecurityGroupRule(t *testing.T, client *gophercloud.ServiceClient, secGroupID string) (*rules.SecGroupRule, error) {
                    
96	t.Logf("Attempting to create security group rule in group: %s", secGroupID)
                    
122// deferred function
                    
123func DeleteSecurityGroup(t *testing.T, client *gophercloud.ServiceClient, secGroupID string) {
                    
124	t.Logf("Attempting to delete security group: %s", secGroupID)
                    
                
db.go https://gitlab.com/unofficial-mirrors/openshift-origin | Go | 145 lines
                    
18// An error will be returned if the database was unable to be created.
                    
19func CreateDatabase(t *testing.T, client *gophercloud.ServiceClient, instanceID string) error {
                    
20	name := tools.RandomString("ACPTTEST", 8)
                    
36// An error will be returned if the instance was unable to be created.
                    
37func CreateInstance(t *testing.T, client *gophercloud.ServiceClient) (*instances.Instance, error) {
                    
38	if testing.Short() {
                    
46
                    
47	name := tools.RandomString("ACPTTEST", 8)
                    
48	t.Logf("Attempting to create instance: %s", name)
                    
73// An error will be returned if the user was unable to be created.
                    
74func CreateUser(t *testing.T, client *gophercloud.ServiceClient, instanceID string) error {
                    
75	name := tools.RandomString("ACPTTEST", 8)
                    
75	name := tools.RandomString("ACPTTEST", 8)
                    
76	password := tools.RandomString("", 8)
                    
77	t.Logf("Attempting to create user: %s", name)
                    
                
authorize_test.go https://gitlab.com/unofficial-mirrors/mattermost-platform | Go | 147 lines
                    
10
                    
11func TestAuthJson(t *testing.T) {
                    
12	a1 := AuthData{}
                    
35
                    
36func TestAuthPreSave(t *testing.T) {
                    
37	a1 := AuthData{}
                    
44
                    
45func TestAuthIsValid(t *testing.T) {
                    
46
                    
52
                    
53	ad.ClientId = NewRandomString(28)
                    
54	if err := ad.IsValid(); err == nil {
                    
62
                    
63	ad.UserId = NewRandomString(28)
                    
64	if err := ad.IsValid(); err == nil {
                    
                
env_test.go https://gitlab.com/JamesClonk/machine | Go | 324 lines
                    
26
                    
27func TestEnvLenDup(t *testing.T) {
                    
28	env := &Env{
                    
38
                    
39func TestEnvGetDup(t *testing.T) {
                    
40	env := &Env{
                    
50
                    
51func TestNewJob(t *testing.T) {
                    
52	job := mkJob(t, "dummy", "--level=awesome")
                    
79
                    
80func TestSetenvBool(t *testing.T) {
                    
81	job := mkJob(t, "dummy")
                    
165	for i := 0; i < l; i++ {
                    
166		t := [2]string{testutils.RandomString(5), testutils.RandomString(20)}
                    
167		res[i] = t
                    
                
rand_test.go https://gitlab.com/unofficial-mirrors/kubernetes | Go | 114 lines
                    
29
                    
30func TestString(t *testing.T) {
                    
31	valid := "0123456789abcdefghijklmnopqrstuvwxyz"
                    
45// Confirm that panic occurs on invalid input.
                    
46func TestRangePanic(t *testing.T) {
                    
47	defer func() {
                    
55
                    
56func TestIntn(t *testing.T) {
                    
57	// 0 is invalid.
                    
65
                    
66func TestPerm(t *testing.T) {
                    
67	Seed(5)
                    
79
                    
80func TestIntnRange(t *testing.T) {
                    
81	// 0 is invalid.
                    
                
lbaas.go https://gitlab.com/unofficial-mirrors/openshift-origin | Go | 160 lines
                    
16// random port. An error will be returned if the member could not be created.
                    
17func CreateMember(t *testing.T, client *gophercloud.ServiceClient, poolID string) (*members.Member, error) {
                    
18	protocolPort := tools.RandomInt(100, 1000)
                    
39// An error will be returned if the monitor could not be created.
                    
40func CreateMonitor(t *testing.T, client *gophercloud.ServiceClient) (*monitors.Monitor, error) {
                    
41	t.Logf("Attempting to create monitor.")
                    
62// if the pool could not be deleted.
                    
63func CreatePool(t *testing.T, client *gophercloud.ServiceClient, subnetID string) (*pools.Pool, error) {
                    
64	poolName := tools.RandomString("TESTACCT-", 8)
                    
87// not be created.
                    
88func CreateVIP(t *testing.T, client *gophercloud.ServiceClient, subnetID, poolID string) (*vips.VirtualIP, error) {
                    
89	vipName := tools.RandomString("TESTACCT-", 8)
                    
114// function.
                    
115func DeleteMember(t *testing.T, client *gophercloud.ServiceClient, memberID string) {
                    
116	t.Logf("Attempting to delete member %s", memberID)
                    
                
handshake_messages_test.go https://github.com/thurday/gcc.git | Go | 206 lines
                    
31
                    
32func TestMarshalUnmarshal(t *testing.T) {
                    
33	rand := rand.New(rand.NewSource(0))
                    
77
                    
78func TestFuzz(t *testing.T) {
                    
79	rand := rand.New(rand.NewSource(0))
                    
99
                    
100func randomString(n int, rand *rand.Rand) string {
                    
101	b := randomBytes(n, rand)
                    
118	if rand.Intn(10) > 5 {
                    
119		m.serverName = randomString(rand.Intn(255), rand)
                    
120	}
                    
144		for i := 0; i < n; i++ {
                    
145			m.nextProtos[i] = randomString(20, rand)
                    
146		}
                    
                
utils_test.go https://gitlab.com/unofficial-mirrors/mattermost-platform | Go | 564 lines
                    
23
                    
24func TestRandomString(t *testing.T) {
                    
25	for i := 0; i < 1000; i++ {
                    
32
                    
33func TestAppError(t *testing.T) {
                    
34	err := NewAppError("TestAppError", "message", nil, "", http.StatusInternalServerError)
                    
43
                    
44func TestAppErrorJunk(t *testing.T) {
                    
45	rerr := AppErrorFromJson(strings.NewReader("<html><body>This is a broken test</body></html>"))
                    
79
                    
80func TestValidEmail(t *testing.T) {
                    
81	if !IsValidEmail("corey+test@hulen.com") {
                    
89
                    
90func TestValidLower(t *testing.T) {
                    
91	if !IsLower("corey+test@hulen.com") {
                    
                
handshake_messages_test.go https://bitbucket.org/Underworld79/toolchain_gcc-4.8.git | Go | 243 lines
                    
34
                    
35func TestMarshalUnmarshal(t *testing.T) {
                    
36	rand := rand.New(rand.NewSource(0))
                    
82
                    
83func TestFuzz(t *testing.T) {
                    
84	rand := rand.New(rand.NewSource(0))
                    
104
                    
105func randomString(n int, rand *rand.Rand) string {
                    
106	b := randomBytes(n, rand)
                    
123	if rand.Intn(10) > 5 {
                    
124		m.serverName = randomString(rand.Intn(255), rand)
                    
125	}
                    
155		for i := 0; i < n; i++ {
                    
156			m.nextProtos[i] = randomString(20, rand)
                    
157		}
                    
                
handshake_messages_test.go https://bitbucket.org/codefirex/toolchain_gcc-4.9.git | Go | 243 lines
                    
34
                    
35func TestMarshalUnmarshal(t *testing.T) {
                    
36	rand := rand.New(rand.NewSource(0))
                    
82
                    
83func TestFuzz(t *testing.T) {
                    
84	rand := rand.New(rand.NewSource(0))
                    
104
                    
105func randomString(n int, rand *rand.Rand) string {
                    
106	b := randomBytes(n, rand)
                    
123	if rand.Intn(10) > 5 {
                    
124		m.serverName = randomString(rand.Intn(255), rand)
                    
125	}
                    
155		for i := 0; i < n; i++ {
                    
156			m.nextProtos[i] = randomString(20, rand)
                    
157		}
                    
                
manager_test.go https://gitlab.com/epicglue/epicglue | Go | 396 lines
                    
11
                    
12func TestManager_Get(t *testing.T) {
                    
13	now := time.Now()
                    
84
                    
85func TestManager_All(t *testing.T) {
                    
86	//now := time.Now()
                    
157
                    
158//func TestDefaultDataManager_Channels(t *testing.T) {
                    
159//    //suffix := helpers.RandomString(8)
                    
195//
                    
196//func TestDefaultDataManager_Channel(t *testing.T) {
                    
197//    suffix := helpers.RandomString(8)
                    
227//
                    
228//func TestDefaultDataManager_CreateChannel(t *testing.T) {
                    
229//    suffix := helpers.RandomString(8)
                    
                
routes_test.go https://gitlab.com/vpl/distribution | Go | 355 lines
                    
30// This may go away as the application structure comes together.
                    
31func TestRouter(t *testing.T) {
                    
32	testCases := []routeTestCase{
                    
178
                    
179func TestRouterWithPathTraversals(t *testing.T) {
                    
180	testCases := []routeTestCase{
                    
199
                    
200func TestRouterWithBadCharacters(t *testing.T) {
                    
201	if testing.Short() {
                    
225				RouteName:  RouteNameTags,
                    
226				RequestURI: fmt.Sprintf("/v2/%v/%v/tags/list", randomString(10), randomString(10)),
                    
227				StatusCode: http.StatusNotFound,
                    
233
                    
234func checkTestRouter(t *testing.T, testCases []routeTestCase, prefix string, deeplyEqual bool) {
                    
235	router := RouterWithPrefix(prefix)
                    
                
identity.go https://gitlab.com/unofficial-mirrors/openshift-origin | Go | 326 lines
                    
20// unable to be created.
                    
21func CreateProject(t *testing.T, client *gophercloud.ServiceClient, c *projects.CreateOpts) (*projects.Project, error) {
                    
22	name := tools.RandomString("ACPTTEST", 8)
                    
47// unable to be created.
                    
48func CreateUser(t *testing.T, client *gophercloud.ServiceClient, c *users.CreateOpts) (*users.User, error) {
                    
49	name := tools.RandomString("ACPTTEST", 8)
                    
74// unable to be created.
                    
75func CreateGroup(t *testing.T, client *gophercloud.ServiceClient, c *groups.CreateOpts) (*groups.Group, error) {
                    
76	name := tools.RandomString("ACPTTEST", 8)
                    
101// unable to be created.
                    
102func CreateDomain(t *testing.T, client *gophercloud.ServiceClient, c *domains.CreateOpts) (*domains.Domain, error) {
                    
103	name := tools.RandomString("ACPTTEST", 8)
                    
128// unable to be created.
                    
129func CreateRole(t *testing.T, client *gophercloud.ServiceClient, c *roles.CreateOpts) (*roles.Role, error) {
                    
130	name := tools.RandomString("ACPTTEST", 8)
                    
                
networking.go https://gitlab.com/unofficial-mirrors/openshift-origin | Go | 246 lines
                    
15// network could not be created.
                    
16func CreateNetwork(t *testing.T, client *gophercloud.ServiceClient) (*networks.Network, error) {
                    
17	networkName := tools.RandomString("TESTACC-", 8)
                    
35// returned if the port could not be created.
                    
36func CreatePort(t *testing.T, client *gophercloud.ServiceClient, networkID, subnetID string) (*ports.Port, error) {
                    
37	portName := tools.RandomString("TESTACC-", 8)
                    
68// attached. An error will be returned if the port could not be created.
                    
69func CreatePortWithNoSecurityGroup(t *testing.T, client *gophercloud.ServiceClient, networkID, subnetID string) (*ports.Port, error) {
                    
70	portName := tools.RandomString("TESTACC-", 8)
                    
103// will be returned if the subnet could not be created.
                    
104func CreateSubnet(t *testing.T, client *gophercloud.ServiceClient, networkID string) (*subnets.Subnet, error) {
                    
105	subnetName := tools.RandomString("TESTACC-", 8)
                    
131// the subnet could not be created.
                    
132func CreateSubnetWithDefaultGateway(t *testing.T, client *gophercloud.ServiceClient, networkID string) (*subnets.Subnet, error) {
                    
133	subnetName := tools.RandomString("TESTACC-", 8)
                    
                
db_test.go git://github.com/bradfitz/camlistore.git | Go | 2666 lines
                    
40	r := rand.New(rand.NewSource(int64(seed)))
                    
41	return randomString(r, n)
                    
42}
                    
44type dbHarness struct {
                    
45	t *testing.T
                    
46
                    
53
                    
54func newDbHarnessWopt(t *testing.T, o *opt.Options) *dbHarness {
                    
55	h := new(dbHarness)
                    
59
                    
60func newDbHarness(t *testing.T) *dbHarness {
                    
61	return newDbHarnessWopt(t, &opt.Options{})
                    
63
                    
64func (h *dbHarness) init(t *testing.T, o *opt.Options) {
                    
65	h.t = t
                    
                
main_test.go https://gitlab.com/0072016/0072016-Google-WebFundementls | Go | 228 lines
                    
48
                    
49func gunzip(t *testing.T, bz []byte) []byte {
                    
50	r, err := gzip.NewReader(bytes.NewReader(bz))
                    
63
                    
64func mkdirs(t *testing.T, path ...string) {
                    
65	p := filepath.Join(path...)
                    
70
                    
71func writeFile(t *testing.T, dir, name string, b []byte) {
                    
72	p := filepath.Join(dir, name)
                    
77
                    
78func TestRandomString(t *testing.T) {
                    
79	a := randomString(32)
                    
82	}
                    
83	b := randomString(32)
                    
84	if a == b {
                    
                
fwaas.go https://gitlab.com/unofficial-mirrors/openshift-origin | Go | 203 lines
                    
17// policy ID. An error will be returned if the firewall could not be created.
                    
18func CreateFirewall(t *testing.T, client *gophercloud.ServiceClient, policyID string) (*firewalls.Firewall, error) {
                    
19	firewallName := tools.RandomString("TESTACC-", 8)
                    
47// returned if the firewall could not be created.
                    
48func CreateFirewallOnRouter(t *testing.T, client *gophercloud.ServiceClient, policyID string, routerID string) (*firewalls.Firewall, error) {
                    
49	firewallName := tools.RandomString("TESTACC-", 8)
                    
79// rule. An error will be returned if the rule could not be created.
                    
80func CreatePolicy(t *testing.T, client *gophercloud.ServiceClient, ruleID string) (*policies.Policy, error) {
                    
81	policyName := tools.RandomString("TESTACC-", 8)
                    
104// the rule could not be created.
                    
105func CreateRule(t *testing.T, client *gophercloud.ServiceClient) (*rules.Rule, error) {
                    
106	ruleName := tools.RandomString("TESTACC-", 8)
                    
137// a deferred function.
                    
138func DeleteFirewall(t *testing.T, client *gophercloud.ServiceClient, firewallID string) {
                    
139	t.Logf("Attempting to delete firewall: %s", firewallID)
                    
                
secgroup_test.go https://gitlab.com/Red54/machine | Go | 177 lines
                    
15
                    
16func TestSecGroups(t *testing.T) {
                    
17	client, err := newClient()
                    
25
                    
26	newName := tools.RandomString("secgroup_", 5)
                    
27	updateSecGroup(t, client, groupID, newName)
                    
43
                    
44func createSecGroup(t *testing.T, client *gophercloud.ServiceClient) string {
                    
45	opts := secgroups.CreateOpts{
                    
45	opts := secgroups.CreateOpts{
                    
46		Name:        tools.RandomString("secgroup_", 5),
                    
47		Description: "something",
                    
57
                    
58func listSecGroups(t *testing.T, client *gophercloud.ServiceClient) {
                    
59	err := secgroups.List(client).EachPage(func(page pagination.Page) (bool, error) {
                    
                
subnets_test.go https://gitlab.com/unofficial-mirrors/openshift-origin | Go | 158 lines
                    
14
                    
15func TestSubnetsList(t *testing.T) {
                    
16	client, err := clients.NewNetworkV2Client()
                    
35
                    
36func TestSubnetCRUD(t *testing.T) {
                    
37	client, err := clients.NewNetworkV2Client()
                    
58	// Update Subnet
                    
59	newSubnetName := tools.RandomString("TESTACC-", 8)
                    
60	updateOpts := subnets.UpdateOpts{
                    
76
                    
77func TestSubnetsDefaultGateway(t *testing.T) {
                    
78	client, err := clients.NewNetworkV2Client()
                    
117
                    
118func TestSubnetsNoGateway(t *testing.T) {
                    
119	client, err := clients.NewNetworkV2Client()
                    
                
subscription_integration_test.go https://gitlab.com/epicglue/api | Go | 164 lines
                    
17// Subscriptions
                    
18func TestSubscriptionsWithIncorrectInput(t *testing.T) {
                    
19	client := http.Client{}
                    
30
                    
31//func TestSubscriptions(t *testing.T) {
                    
32//	client := http.Client{}
                    
48//// Subscribe
                    
49//func subscribeWithPayload(t *testing.T, payload map[string]interface{}) {
                    
50//	client := http.Client{}
                    
63//
                    
64//func TestSubscribePerUserWithValue(t *testing.T) {
                    
65//	numberOfSubs := howManySubscriptionsUserHas(USER_ID)
                    
69//		"profile_id": PROFILE_ID,
                    
70//		"value":      helpers.RandomString(8),
                    
71//	}
                    
                
env_test.go https://gitlab.com/Red54/machine | Go | 324 lines
                    
26
                    
27func TestEnvLenDup(t *testing.T) {
                    
28	env := &Env{
                    
38
                    
39func TestEnvGetDup(t *testing.T) {
                    
40	env := &Env{
                    
50
                    
51func TestNewJob(t *testing.T) {
                    
52	job := mkJob(t, "dummy", "--level=awesome")
                    
79
                    
80func TestSetenvBool(t *testing.T) {
                    
81	job := mkJob(t, "dummy")
                    
165	for i := 0; i < l; i++ {
                    
166		t := [2]string{testutils.RandomString(5), testutils.RandomString(20)}
                    
167		res[i] = t
                    
                
blockstorage.go https://gitlab.com/unofficial-mirrors/openshift-origin | Go | 142 lines
                    
17// error will be returned if the volume was unable to be created.
                    
18func CreateVolume(t *testing.T, client *gophercloud.ServiceClient) (*volumes.Volume, error) {
                    
19	if testing.Short() {
                    
22
                    
23	volumeName := tools.RandomString("ACPTTEST", 16)
                    
24	t.Logf("Attempting to create volume: %s", volumeName)
                    
45// 1GB. An error will be returned if the volume was unable to be created.
                    
46func CreateVolumeFromImage(t *testing.T, client *gophercloud.ServiceClient) (*volumes.Volume, error) {
                    
47	if testing.Short() {
                    
55
                    
56	volumeName := tools.RandomString("ACPTTEST", 16)
                    
57	t.Logf("Attempting to create volume: %s", volumeName)
                    
79// failed to be deleted. This works best when used as a deferred function.
                    
80func DeleteVolume(t *testing.T, client *gophercloud.ServiceClient, volume *volumes.Volume) {
                    
81	err := volumes.Delete(client, volume.ID).ExtractErr()
                    
                
dns.go https://gitlab.com/unofficial-mirrors/openshift-origin | Go | 164 lines
                    
13// be returned if the zone was unable to be created.
                    
14func CreateRecordSet(t *testing.T, client *gophercloud.ServiceClient, zone *zones.Zone) (*recordsets.RecordSet, error) {
                    
15	t.Logf("Attempting to create recordset: %s", zone.Name)
                    
45// be returned if the zone was unable to be created.
                    
46func CreateZone(t *testing.T, client *gophercloud.ServiceClient) (*zones.Zone, error) {
                    
47	zoneName := tools.RandomString("ACPTTEST", 8) + ".com."
                    
79// This is only for example purposes as it will try to do a zone transfer.
                    
80func CreateSecondaryZone(t *testing.T, client *gophercloud.ServiceClient) (*zones.Zone, error) {
                    
81	zoneName := tools.RandomString("ACPTTEST", 8) + ".com."
                    
110// function.
                    
111func DeleteRecordSet(t *testing.T, client *gophercloud.ServiceClient, rs *recordsets.RecordSet) {
                    
112	err := recordsets.Delete(client, rs.ZoneID, rs.ID).ExtractErr()
                    
122// function.
                    
123func DeleteZone(t *testing.T, client *gophercloud.ServiceClient, zone *zones.Zone) {
                    
124	_, err := zones.Delete(client, zone.ID).Extract()
                    
                
helpers_test.go https://gitlab.com/epicglue/common | Go | 141 lines
                    
31
                    
32func TestRandomString(t *testing.T) {
                    
33	r1 := helpers.RandomString(8)
                    
38
                    
39	r3 := helpers.RandomString(1)
                    
40	assert.Len(t, r3, 1)
                    
60
                    
61func TestFlattenArrayOfStrings(t *testing.T) {
                    
62	assert.Equal(t, "[]", helpers.FlattenArrayOfStrings([]string{}))
                    
72
                    
73func TestStringToInt64(t *testing.T) {
                    
74	assert.Equal(t, helpers.StringToInt64("-9223372036854775808"), int64(-9223372036854775808))
                    
77
                    
78func TestStringToFloat64(t *testing.T) {
                    
79	assert.Equal(t, helpers.StringToFloat64("4.11"), float64(4.11))
                    
                
routers_test.go https://gitlab.com/unofficial-mirrors/openshift-origin | Go | 119 lines
                    
14
                    
15func TestLayer3RouterList(t *testing.T) {
                    
16	client, err := clients.NewNetworkV2Client()
                    
36
                    
37func TestLayer3ExternalRouterCreateDelete(t *testing.T) {
                    
38	client, err := clients.NewNetworkV2Client()
                    
50
                    
51	newName := tools.RandomString("TESTACC-", 8)
                    
52	updateOpts := routers.UpdateOpts{
                    
68
                    
69func TestLayer3RouterInterface(t *testing.T) {
                    
70	client, err := clients.NewNetworkV2Client()
                    
                
user_integration_test.go https://gitlab.com/epicglue/api | Go | 124 lines
                    
12
                    
13//func TestMe(t *testing.T) {
                    
14//	client := http.Client{}
                    
33
                    
34func TestLoginByWrongEmail(t *testing.T) {
                    
35	client := http.Client{}
                    
49
                    
50func TestLoginByEmail(t *testing.T) {
                    
51	client := http.Client{}
                    
69
                    
70func TestRegisterByExistingEmail(t *testing.T) {
                    
71	client := http.Client{}
                    
85
                    
86func TestRegisterByWrongEmail(t *testing.T) {
                    
87	client := http.Client{}
                    
                
handshake_messages_test.go https://bitbucket.org/codefirex/toolchain_gcc-4.8.git | Go | 243 lines
                    
34
                    
35func TestMarshalUnmarshal(t *testing.T) {
                    
36	rand := rand.New(rand.NewSource(0))
                    
82
                    
83func TestFuzz(t *testing.T) {
                    
84	rand := rand.New(rand.NewSource(0))
                    
104
                    
105func randomString(n int, rand *rand.Rand) string {
                    
106	b := randomBytes(n, rand)
                    
123	if rand.Intn(10) > 5 {
                    
124		m.serverName = randomString(rand.Intn(255), rand)
                    
125	}
                    
155		for i := 0; i < n; i++ {
                    
156			m.nextProtos[i] = randomString(20, rand)
                    
157		}
                    
                
objects_test.go https://gitlab.com/unofficial-mirrors/openshift-origin | Go | 257 lines
                    
19
                    
20func TestObjects(t *testing.T) {
                    
21	client, err := clients.NewObjectStorageV1Client()
                    
28	for i := 0; i < len(oNames); i++ {
                    
29		oNames[i] = tools.RandomString("test-object-", 8)
                    
30	}
                    
32	// Create a container to hold the test objects.
                    
33	cName := tools.RandomString("test-container-", 8)
                    
34	header, err := containers.Create(client, cName, nil).Extract()
                    
46	for i := 0; i < numObjects; i++ {
                    
47		oContents[i] = bytes.NewBuffer([]byte(tools.RandomString("", 10)))
                    
48		createOpts := objects.CreateOpts{
                    
139
                    
140func TestObjectsListSubdir(t *testing.T) {
                    
141	client, err := clients.NewObjectStorageV1Client()
                    
                
floatingip_test.go https://gitlab.com/Red54/machine | Go | 107 lines
                    
15
                    
16func createFIPServer(t *testing.T, client *gophercloud.ServiceClient, choices *ComputeChoices) (*servers.Server, error) {
                    
17	if testing.Short() {
                    
20
                    
21	name := tools.RandomString("ACPTTEST", 16)
                    
22	t.Logf("Attempting to create server: %s\n", name)
                    
40
                    
41func createFloatingIP(t *testing.T, client *gophercloud.ServiceClient) (*floatingip.FloatingIP, error) {
                    
42	pool := os.Getenv("OS_POOL_NAME")
                    
51
                    
52func associateFloatingIP(t *testing.T, client *gophercloud.ServiceClient, serverId string, fip *floatingip.FloatingIP) {
                    
53	err := floatingip.Associate(client, serverId, fip.IP).ExtractErr()
                    
65
                    
66func TestFloatingIP(t *testing.T) {
                    
67	pool := os.Getenv("OS_POOL_NAME")
                    
                
imageservice.go https://gitlab.com/unofficial-mirrors/openshift-origin | Go | 55 lines
                    
14// An error will be returned if an image was unable to be created.
                    
15func CreateEmptyImage(t *testing.T, client *gophercloud.ServiceClient) (*images.Image, error) {
                    
16	var image *images.Image
                    
17
                    
18	name := tools.RandomString("ACPTTEST", 16)
                    
19	t.Logf("Attempting to create image: %s", name)
                    
47// used as a deferred function.
                    
48func DeleteImage(t *testing.T, client *gophercloud.ServiceClient, image *images.Image) {
                    
49	err := images.Delete(client, image.ID).ExtractErr()
                    
                
metric_test.go https://gitlab.com/verminio/gofw | Go | 82 lines
                    
9
                    
10func TestNew(t *testing.T) {
                    
11	id := gen.RandomString(5)
                    
22
                    
23func TestStart(t *testing.T) {
                    
24	id := gen.RandomString(5)
                    
48
                    
49func TestEnd(t *testing.T) {
                    
50	id := gen.RandomString(5)
                    
                
ports_test.go https://gitlab.com/unofficial-mirrors/openshift-origin | Go | 349 lines
                    
13
                    
14func TestPortsList(t *testing.T) {
                    
15	client, err := clients.NewNetworkV2Client()
                    
34
                    
35func TestPortsCRUD(t *testing.T) {
                    
36	client, err := clients.NewNetworkV2Client()
                    
68	// Update port
                    
69	newPortName := tools.RandomString("TESTACC-", 8)
                    
70	updateOpts := ports.UpdateOpts{
                    
80
                    
81func TestPortsRemoveSecurityGroups(t *testing.T) {
                    
82	client, err := clients.NewNetworkV2Client()
                    
141
                    
142func TestPortsDontAlterSecurityGroups(t *testing.T) {
                    
143	client, err := clients.NewNetworkV2Client()
                    
                
volumeattach_test.go https://gitlab.com/Red54/machine | Go | 130 lines
                    
21
                    
22func newBlockClient(t *testing.T) (*gophercloud.ServiceClient, error) {
                    
23	ao, err := rackspace.AuthOptionsFromEnv()
                    
33
                    
34func createVAServer(t *testing.T, computeClient *gophercloud.ServiceClient, choices *serverOpts) (*osServers.Server, error) {
                    
35	if testing.Short() {
                    
38
                    
39	name := tools.RandomString("ACPTTEST", 16)
                    
40	t.Logf("Attempting to create server: %s\n", name)
                    
58
                    
59func createVAVolume(t *testing.T, blockClient *gophercloud.ServiceClient) (*volumes.Volume, error) {
                    
60	volume, err := volumes.Create(blockClient, &osVolumes.CreateOpts{
                    
72
                    
73func createVolumeAttachment(t *testing.T, computeClient *gophercloud.ServiceClient, blockClient *gophercloud.ServiceClient, serverID string, volumeID string) {
                    
74	va, err := volumeattach.Create(computeClient, serverID, &osVolumeAttach.CreateOpts{
                    
                
containers_test.go https://gitlab.com/unofficial-mirrors/openshift-origin | Go | 146 lines
                    
18
                    
19func TestContainers(t *testing.T) {
                    
20	client, err := clients.NewObjectStorageV1Client()
                    
27	for i := 0; i < numContainers; i++ {
                    
28		cNames[i] = tools.RandomString("gophercloud-test-container-", 8)
                    
29	}
                    
97
                    
98func TestListAllContainers(t *testing.T) {
                    
99	client, err := clients.NewObjectStorageV1Client()
                    
108	for i := 0; i < numContainers; i++ {
                    
109		cNames[i] = tools.RandomString("gophercloud-test-container-", 8)
                    
110	}
                    
                
helpers_test.go https://gitlab.com/epicglue/api | Go | 141 lines
                    
31
                    
32func TestRandomString(t *testing.T) {
                    
33	r1 := helpers.RandomString(8)
                    
38
                    
39	r3 := helpers.RandomString(1)
                    
40	assert.Len(t, r3, 1)
                    
60
                    
61func TestFlattenArrayOfStrings(t *testing.T) {
                    
62	assert.Equal(t, "[]", helpers.FlattenArrayOfStrings([]string{}))
                    
72
                    
73func TestStringToInt64(t *testing.T) {
                    
74	assert.Equal(t, helpers.StringToInt64("-9223372036854775808"), int64(-9223372036854775808))
                    
77
                    
78func TestStringToFloat64(t *testing.T) {
                    
79	assert.Equal(t, helpers.StringToFloat64("4.11"), float64(4.11))
                    
                
user_test.go https://gitlab.com/JamesClonk/machine | Go | 127 lines
                    
16
                    
17func TestUsers(t *testing.T) {
                    
18	client := authenticatedClient(t)
                    
34
                    
35func findTenant(t *testing.T, client *gophercloud.ServiceClient) string {
                    
36	var tenantID string
                    
52
                    
53func createUser(t *testing.T, client *gophercloud.ServiceClient, tenantID string) string {
                    
54	t.Log("Creating user")
                    
56	opts := users.CreateOpts{
                    
57		Name:     tools.RandomString("user_", 5),
                    
58		Enabled:  users.Disabled,
                    
69
                    
70func listUsers(t *testing.T, client *gophercloud.ServiceClient) {
                    
71	err := users.List(client).EachPage(func(page pagination.Page) (bool, error) {
                    
                
blockstorage.go https://gitlab.com/unofficial-mirrors/openshift-origin | Go | 142 lines
                    
17// error will be returned if the volume was unable to be created.
                    
18func CreateVolume(t *testing.T, client *gophercloud.ServiceClient) (*volumes.Volume, error) {
                    
19	if testing.Short() {
                    
22
                    
23	volumeName := tools.RandomString("ACPTTEST", 16)
                    
24	t.Logf("Attempting to create volume: %s", volumeName)
                    
45// 1GB. An error will be returned if the volume was unable to be created.
                    
46func CreateVolumeFromImage(t *testing.T, client *gophercloud.ServiceClient) (*volumes.Volume, error) {
                    
47	if testing.Short() {
                    
55
                    
56	volumeName := tools.RandomString("ACPTTEST", 16)
                    
57	t.Logf("Attempting to create volume: %s", volumeName)
                    
79// failed to be deleted. This works best when used as a deferred function.
                    
80func DeleteVolume(t *testing.T, client *gophercloud.ServiceClient, volume *volumes.Volume) {
                    
81	err := volumes.Delete(client, volume.ID).ExtractErr()
                    
                
containers_test.go https://gitlab.com/Red54/machine | Go | 137 lines
                    
17
                    
18func TestContainers(t *testing.T) {
                    
19	// Create a new client to execute the HTTP requests. See common.go for newClient body.
                    
24	for i := 0; i < numContainers; i++ {
                    
25		cNames[i] = tools.RandomString("gophercloud-test-container-", 8)
                    
26	}
                    
90
                    
91func TestListAllContainers(t *testing.T) {
                    
92	// Create a new client to execute the HTTP requests. See common.go for newClient body.
                    
99	for i := 0; i < numContainers; i++ {
                    
100		cNames[i] = tools.RandomString("gophercloud-test-container-", 8)
                    
101	}
                    
                
user_test.go https://gitlab.com/JamesClonk/machine | Go | 93 lines
                    
16
                    
17func TestUsers(t *testing.T) {
                    
18	client := authenticatedClient(t)
                    
32
                    
33func createUser(t *testing.T, client *gophercloud.ServiceClient) string {
                    
34	t.Log("Creating user")
                    
36	opts := users.CreateOpts{
                    
37		Username: tools.RandomString("user_", 5),
                    
38		Enabled:  os.Disabled,
                    
48
                    
49func listUsers(t *testing.T, client *gophercloud.ServiceClient) {
                    
50	err := users.List(client).EachPage(func(page pagination.Page) (bool, error) {
                    
64
                    
65func getUser(t *testing.T, client *gophercloud.ServiceClient, userID string) {
                    
66	_, err := users.Get(client, userID).Extract()
                    
                
blockstorage.go https://gitlab.com/unofficial-mirrors/openshift-origin | Go | 142 lines
                    
18// created.
                    
19func CreateSnapshot(t *testing.T, client *gophercloud.ServiceClient, volume *volumes.Volume) (*snapshots.Snapshot, error) {
                    
20	if testing.Short() {
                    
23
                    
24	snapshotName := tools.RandomString("ACPTTEST", 16)
                    
25	t.Logf("Attempting to create snapshot %s based on volume %s", snapshotName, volume.ID)
                    
46// error will be returned if the volume was unable to be created.
                    
47func CreateVolume(t *testing.T, client *gophercloud.ServiceClient) (*volumes.Volume, error) {
                    
48	if testing.Short() {
                    
51
                    
52	volumeName := tools.RandomString("ACPTTEST", 16)
                    
53	t.Logf("Attempting to create volume: %s", volumeName)
                    
74// be returned if the volume type was unable to be created.
                    
75func CreateVolumeType(t *testing.T, client *gophercloud.ServiceClient) (*volumetypes.VolumeType, error) {
                    
76	volumeTypeName := tools.RandomString("ACPTTEST", 16)
                    
                
db_test.go https://bitbucket.org/cloudwallet/goleveldb.git | Go | 2926 lines
                    
43	r := rand.New(rand.NewSource(int64(seed)))
                    
44	return randomString(r, n)
                    
45}
                    
46
                    
47func testingLogger(t *testing.T) func(log string) {
                    
48	return func(log string) {
                    
52
                    
53func testingPreserveOnFailed(t *testing.T) func() (preserve bool, err error) {
                    
54	return func() (preserve bool, err error) {
                    
60type dbHarness struct {
                    
61	t *testing.T
                    
62
                    
69
                    
70func newDbHarnessWopt(t *testing.T, o *opt.Options) *dbHarness {
                    
71	h := new(dbHarness)
                    
                
objects_test.go https://gitlab.com/JamesClonk/machine | Go | 119 lines
                    
19
                    
20func TestObjects(t *testing.T) {
                    
21	// Create a provider client for executing the HTTP request.
                    
27	for i := 0; i < len(oNames); i++ {
                    
28		oNames[i] = tools.RandomString("test-object-", 8)
                    
29	}
                    
31	// Create a container to hold the test objects.
                    
32	cName := tools.RandomString("test-container-", 8)
                    
33	header, err := containers.Create(client, cName, nil).ExtractHeader()
                    
45	for i := 0; i < numObjects; i++ {
                    
46		oContents[i] = bytes.NewBuffer([]byte(tools.RandomString("", 10)))
                    
47		res := objects.Create(client, cName, oNames[i], oContents[i], nil)
                    
                
securityservices.go https://gitlab.com/unofficial-mirrors/openshift-origin | Go | 60 lines
                    
12// error will be returned if the security service was unable to be created.
                    
13func CreateSecurityService(t *testing.T, client *gophercloud.ServiceClient) (*securityservices.SecurityService, error) {
                    
14	if testing.Short() {
                    
17
                    
18	securityServiceName := tools.RandomString("ACPTTEST", 16)
                    
19	t.Logf("Attempting to create security service: %s", securityServiceName)
                    
35// the security service was unable to be deleted.
                    
36func DeleteSecurityService(t *testing.T, client *gophercloud.ServiceClient, securityService *securityservices.SecurityService) {
                    
37	err := securityservices.Delete(client, securityService.ID).ExtractErr()
                    
45// PrintSecurityService will print a security service and all of its attributes.
                    
46func PrintSecurityService(t *testing.T, securityService *securityservices.SecurityService) {
                    
47	t.Logf("ID: %s", securityService.ID)
                    
                
keypairs_test.go https://gitlab.com/JamesClonk/machine | Go | 87 lines
                    
15
                    
16func deleteKeyPair(t *testing.T, client *gophercloud.ServiceClient, name string) {
                    
17	err := keypairs.Delete(client, name).ExtractErr()
                    
21
                    
22func TestCreateKeyPair(t *testing.T) {
                    
23	client, err := newClient()
                    
25
                    
26	name := tools.RandomString("createdkey-", 8)
                    
27	k, err := keypairs.Create(client, os.CreateOpts{Name: name}).Extract()
                    
38
                    
39func TestImportKeyPair(t *testing.T) {
                    
40	client, err := newClient()
                    
42
                    
43	name := tools.RandomString("importedkey-", 8)
                    
44	pubkey := "ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABAQDlIQ3r+zd97kb9Hzmujd3V6pbO53eb3Go4q2E8iqVGWQfZTrFdL9KACJnqJIm9HmncfRkUTxE37hqeGCCv8uD+ZPmPiZG2E60OX1mGDjbbzAyReRwYWXgXHopggZTLak5k4mwZYaxwaufbVBDRn847e01lZnaXaszEToLM37NLw+uz29sl3TwYy2R0RGHPwPc160aWmdLjSyd1Nd4c9pvvOP/EoEuBjIC6NJJwg2Rvg9sjjx9jYj0QUgc8CqKLN25oMZ69kNJzlFylKRUoeeVr89txlR59yehJWk6Uw6lYFTdJmcmQOFVAJ12RMmS1hLWCM8UzAgtw+EDa0eqBxBDl smash@winter"
                    
                
sharetypes.go https://gitlab.com/unofficial-mirrors/openshift-origin | Go | 56 lines
                    
12// error will be returned if the share type was unable to be created.
                    
13func CreateShareType(t *testing.T, client *gophercloud.ServiceClient) (*sharetypes.ShareType, error) {
                    
14	if testing.Short() {
                    
17
                    
18	shareTypeName := tools.RandomString("ACPTTEST", 16)
                    
19	t.Logf("Attempting to create share type: %s", shareTypeName)
                    
40// the share type was unable to be deleted.
                    
41func DeleteShareType(t *testing.T, client *gophercloud.ServiceClient, shareType *sharetypes.ShareType) {
                    
42	err := sharetypes.Delete(client, shareType.ID).ExtractErr()
                    
50// PrintShareType will print a share type and all of its attributes.
                    
51func PrintShareType(t *testing.T, shareType *sharetypes.ShareType) {
                    
52	t.Logf("Name: %s", shareType.Name)
                    
                
handshake_messages_test.go https://bitbucket.org/kxing/gcc-cilkplus.git | Go | 243 lines
                    
34
                    
35func TestMarshalUnmarshal(t *testing.T) {
                    
36	rand := rand.New(rand.NewSource(0))
                    
82
                    
83func TestFuzz(t *testing.T) {
                    
84	rand := rand.New(rand.NewSource(0))
                    
104
                    
105func randomString(n int, rand *rand.Rand) string {
                    
106	b := randomBytes(n, rand)
                    
123	if rand.Intn(10) > 5 {
                    
124		m.serverName = randomString(rand.Intn(255), rand)
                    
125	}
                    
155		for i := 0; i < n; i++ {
                    
156			m.nextProtos[i] = randomString(20, rand)
                    
157		}
                    
                
volumeattach_test.go https://gitlab.com/unofficial-mirrors/openshift-origin | Go | 78 lines
                    
13
                    
14func TestVolumeAttachAttachment(t *testing.T) {
                    
15	if testing.Short() {
                    
54
                    
55func createVolume(t *testing.T, blockClient *gophercloud.ServiceClient) (*volumes.Volume, error) {
                    
56	volumeName := tools.RandomString("ACPTTEST", 16)
                    
70
                    
71func deleteVolume(t *testing.T, blockClient *gophercloud.ServiceClient, volume *volumes.Volume) {
                    
72	err := volumes.Delete(blockClient, volume.ID).ExtractErr()
                    
                
counter_integration_test.go https://gitlab.com/epicglue/api | Go | 125 lines
                    
32
                    
33	return &user, helpers.RandomString(16)
                    
34}
                    
35
                    
36func TestTooLongKey(t *testing.T) {
                    
37	user, _ := makeTestData()
                    
37	user, _ := makeTestData()
                    
38	key := helpers.RandomString(101)
                    
39
                    
47
                    
48func TestDecimalPoints(t *testing.T) {
                    
49
                    
51
                    
52func TestInc(t *testing.T) {
                    
53	user, key := makeTestData()
                    
                
sharenetworks.go https://gitlab.com/unofficial-mirrors/openshift-origin | Go | 60 lines
                    
12// error will be returned if the share network was unable to be created.
                    
13func CreateShareNetwork(t *testing.T, client *gophercloud.ServiceClient) (*sharenetworks.ShareNetwork, error) {
                    
14	if testing.Short() {
                    
17
                    
18	shareNetworkName := tools.RandomString("ACPTTEST", 16)
                    
19	t.Logf("Attempting to create share network: %s", shareNetworkName)
                    
35// the share network was unable to be deleted.
                    
36func DeleteShareNetwork(t *testing.T, client *gophercloud.ServiceClient, shareNetwork *sharenetworks.ShareNetwork) {
                    
37	err := sharenetworks.Delete(client, shareNetwork.ID).ExtractErr()
                    
45// PrintShareNetwork will print a share network and all of its attributes.
                    
46func PrintShareNetwork(t *testing.T, sharenetwork *sharenetworks.ShareNetwork) {
                    
47	t.Logf("ID: %s", sharenetwork.ID)
                    
                
user_test.go https://gitlab.com/Red54/machine | Go | 127 lines
                    
16
                    
17func TestUsers(t *testing.T) {
                    
18	client := authenticatedClient(t)
                    
34
                    
35func findTenant(t *testing.T, client *gophercloud.ServiceClient) string {
                    
36	var tenantID string
                    
52
                    
53func createUser(t *testing.T, client *gophercloud.ServiceClient, tenantID string) string {
                    
54	t.Log("Creating user")
                    
56	opts := users.CreateOpts{
                    
57		Name:     tools.RandomString("user_", 5),
                    
58		Enabled:  users.Disabled,
                    
69
                    
70func listUsers(t *testing.T, client *gophercloud.ServiceClient) {
                    
71	err := users.List(client).EachPage(func(page pagination.Page) (bool, error) {
                    
                
tenantnetworks_test.go https://gitlab.com/Red54/machine | Go | 109 lines
                    
15
                    
16func getNetworkID(t *testing.T, client *gophercloud.ServiceClient, networkName string) (string, error) {
                    
17	allPages, err := tenantnetworks.List(client).AllPages()
                    
39
                    
40func createNetworkServer(t *testing.T, client *gophercloud.ServiceClient, choices *ComputeChoices, networkID string) (*servers.Server, error) {
                    
41	if testing.Short() {
                    
44
                    
45	name := tools.RandomString("ACPTTEST", 16)
                    
46	t.Logf("Attempting to create server: %s\n", name)
                    
70
                    
71func TestTenantNetworks(t *testing.T) {
                    
72	networkName := os.Getenv("OS_NETWORK_NAME")
                    
                
user_test.go https://gitlab.com/Red54/machine | Go | 93 lines
                    
16
                    
17func TestUsers(t *testing.T) {
                    
18	client := authenticatedClient(t)
                    
32
                    
33func createUser(t *testing.T, client *gophercloud.ServiceClient) string {
                    
34	t.Log("Creating user")
                    
36	opts := users.CreateOpts{
                    
37		Username: tools.RandomString("user_", 5),
                    
38		Enabled:  os.Disabled,
                    
48
                    
49func listUsers(t *testing.T, client *gophercloud.ServiceClient) {
                    
50	err := users.List(client).EachPage(func(page pagination.Page) (bool, error) {
                    
64
                    
65func getUser(t *testing.T, client *gophercloud.ServiceClient, userID string) {
                    
66	_, err := users.Get(client, userID).Extract()
                    
                
service_integration_test.go https://gitlab.com/epicglue/api | Go | 111 lines
                    
18		"service_user_id": fmt.Sprintf("%d", helpers.RandomNumber(16)),
                    
19		"token":           helpers.RandomString(32),
                    
20		"username":        "John Doe",
                    
42
                    
43func TestConnectServiceUnauthorized(t *testing.T) {
                    
44	client := http.Client{}
                    
55
                    
56//func TestConnectServiceInvalidRequest(t *testing.T) {
                    
57//	client := http.Client{}
                    
68//
                    
69//func TestConnectServiceEmptyToken(t *testing.T) {
                    
70//	testRequest := getTestRequest()
                    
84//
                    
85//func TestConnectServiceInvalidService(t *testing.T) {
                    
86//	testRequest := getTestRequest()
                    
                
tools.go https://gitlab.com/unofficial-mirrors/openshift-origin | Go | 73 lines
                    
32func MakeNewPassword(oldPass string) string {
                    
33	randomPassword := RandomString("", 16)
                    
34	for randomPassword == oldPass {
                    
34	for randomPassword == oldPass {
                    
35		randomPassword = RandomString("", 16)
                    
36	}
                    
39
                    
40// RandomString generates a string of given length, but random content.
                    
41// All content will be within the ASCII graphic character set.
                    
43// http://stackoverflow.com/questions/12771930/what-is-the-fastest-way-to-generate-a-long-random-string-in-go).
                    
44func RandomString(prefix string, n int) string {
                    
45	const alphanum = "0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz"
                    
69// PrintResource returns a resource as a readable structure
                    
70func PrintResource(t *testing.T, resource interface{}) {
                    
71	b, _ := json.MarshalIndent(resource, "", "  ")
                    
                
random_test.go https://gitlab.com/shinvdu/syncthing | Go | 63 lines
                    
10
                    
11func TestSeedFromBytes(t *testing.T) {
                    
12	// should always return the same seed for the same bytes
                    
27
                    
28func TestRandomString(t *testing.T) {
                    
29	for _, l := range []int{0, 1, 2, 3, 4, 8, 42} {
                    
29	for _, l := range []int{0, 1, 2, 3, 4, 8, 42} {
                    
30		s := RandomString(l)
                    
31		if len(s) != l {
                    
37	for i := range strings {
                    
38		strings[i] = RandomString(8)
                    
39		for j := range strings {
                    
49
                    
50func TestRandomInt64(t *testing.T) {
                    
51	ints := make([]int64, 1000)
                    
                
oauth_test.go https://gitlab.com/unofficial-mirrors/mattermost-platform | Go | 94 lines
                    
11
                    
12func TestOAuthRevokeAccessToken(t *testing.T) {
                    
13	th := Setup()
                    
15
                    
16	if err := th.App.RevokeAccessToken(model.NewRandomString(16)); err == nil {
                    
17		t.Fatal("Should have failed bad token")
                    
47
                    
48func TestOAuthDeleteApp(t *testing.T) {
                    
49	th := Setup()
                    
                
objects_test.go https://gitlab.com/Red54/machine | Go | 119 lines
                    
19
                    
20func TestObjects(t *testing.T) {
                    
21	// Create a provider client for executing the HTTP request.
                    
27	for i := 0; i < len(oNames); i++ {
                    
28		oNames[i] = tools.RandomString("test-object-", 8)
                    
29	}
                    
31	// Create a container to hold the test objects.
                    
32	cName := tools.RandomString("test-container-", 8)
                    
33	header, err := containers.Create(client, cName, nil).ExtractHeader()
                    
45	for i := 0; i < numObjects; i++ {
                    
46		oContents[i] = bytes.NewBuffer([]byte(tools.RandomString("", 10)))
                    
47		res := objects.Create(client, cName, oNames[i], oContents[i], nil)
                    
                
keypairs_test.go https://gitlab.com/Red54/machine | Go | 87 lines
                    
15
                    
16func deleteKeyPair(t *testing.T, client *gophercloud.ServiceClient, name string) {
                    
17	err := keypairs.Delete(client, name).ExtractErr()
                    
21
                    
22func TestCreateKeyPair(t *testing.T) {
                    
23	client, err := newClient()
                    
25
                    
26	name := tools.RandomString("createdkey-", 8)
                    
27	k, err := keypairs.Create(client, os.CreateOpts{Name: name}).Extract()
                    
38
                    
39func TestImportKeyPair(t *testing.T) {
                    
40	client, err := newClient()
                    
42
                    
43	name := tools.RandomString("importedkey-", 8)
                    
44	pubkey := "ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABAQDlIQ3r+zd97kb9Hzmujd3V6pbO53eb3Go4q2E8iqVGWQfZTrFdL9KACJnqJIm9HmncfRkUTxE37hqeGCCv8uD+ZPmPiZG2E60OX1mGDjbbzAyReRwYWXgXHopggZTLak5k4mwZYaxwaufbVBDRn847e01lZnaXaszEToLM37NLw+uz29sl3TwYy2R0RGHPwPc160aWmdLjSyd1Nd4c9pvvOP/EoEuBjIC6NJJwg2Rvg9sjjx9jYj0QUgc8CqKLN25oMZ69kNJzlFylKRUoeeVr89txlR59yehJWk6Uw6lYFTdJmcmQOFVAJ12RMmS1hLWCM8UzAgtw+EDa0eqBxBDl smash@winter"
                    
                
utils_test.go https://code.google.com/p/sortingo/ | Go | 296 lines
                    
39
                    
40// randomStrings consists of strings of 100 mixed-case letters and numbers.
                    
41var randomStrings []string
                    
72	// Generate a set of random strings, each of length 100.
                    
73	randomStrings = make([]string, largeDataSize)
                    
74	for i := range randomStrings {
                    
85		}
                    
86		randomStrings[i] = string(bb.Bytes())
                    
87	}
                    
140// basic of input sequences in order to test its robustness.
                    
141func testSortArguments(t *testing.T, f func([]string)) {
                    
142	// these should silently do nothing
                    
170// repeated strings.
                    
171func testSortRepeated(t *testing.T, f func([]string), size int) {
                    
172	checkTestSize(t, size)
                    
                
portsbinding.go https://gitlab.com/unofficial-mirrors/openshift-origin | Go | 48 lines
                    
19// returned if the port could not be created.
                    
20func CreatePortsbinding(t *testing.T, client *gophercloud.ServiceClient, networkID, subnetID, hostID string) (PortWithBindingExt, error) {
                    
21	portName := tools.RandomString("TESTACC-", 8)
                    
                
containers_test.go https://gitlab.com/JamesClonk/machine | Go | 89 lines
                    
17
                    
18func TestContainers(t *testing.T) {
                    
19	// Create a new client to execute the HTTP requests. See common.go for newClient body.
                    
24	for i := 0; i < numContainers; i++ {
                    
25		cNames[i] = tools.RandomString("gophercloud-test-container-", 8)
                    
26	}
                    
                
bootfromvolume_test.go https://gitlab.com/JamesClonk/machine | Go | 55 lines
                    
13
                    
14func TestBootFromVolume(t *testing.T) {
                    
15	client, err := newClient()
                    
26
                    
27	name := tools.RandomString("Gophercloud-", 8)
                    
28	t.Logf("Creating server [%s].", name)
                    
                
keypairs_test.go https://gitlab.com/JamesClonk/machine | Go | 74 lines
                    
19
                    
20func TestCreateServerWithKeyPair(t *testing.T) {
                    
21	client, err := newClient()
                    
44
                    
45	name := tools.RandomString("Gophercloud-", 8)
                    
46	t.Logf("Creating server [%s] with key pair.", name)
                    
                
access_test.go https://gitlab.com/unofficial-mirrors/mattermost-platform | Go | 97 lines
                    
10
                    
11func TestAccessJson(t *testing.T) {
                    
12	a1 := AccessData{}
                    
25
                    
26func TestAccessIsValid(t *testing.T) {
                    
27	ad := AccessData{}
                    
32
                    
33	ad.ClientId = NewRandomString(28)
                    
34	if err := ad.IsValid(); err == nil {
                    
47
                    
48	ad.UserId = NewRandomString(28)
                    
49	if err := ad.IsValid(); err == nil {
                    
62
                    
63	ad.Token = NewRandomString(22)
                    
64	if err := ad.IsValid(); err == nil {
                    
                
bootfromvolume_test.go https://gitlab.com/Red54/machine | Go | 49 lines
                    
14
                    
15func TestBootFromVolume(t *testing.T) {
                    
16	client, err := newClient()
                    
25
                    
26	name := tools.RandomString("Gophercloud-", 8)
                    
27	t.Logf("Creating server [%s].", name)
                    
                
random_test.go https://gitlab.com/0072016/syncthing | Go | 63 lines
                    
10
                    
11func TestSeedFromBytes(t *testing.T) {
                    
12	// should always return the same seed for the same bytes
                    
27
                    
28func TestRandomString(t *testing.T) {
                    
29	for _, l := range []int{0, 1, 2, 3, 4, 8, 42} {
                    
49
                    
50func TestRandomInt64(t *testing.T) {
                    
51	ints := make([]int64, 1000)
                    
                
user_access_token_test.go https://gitlab.com/unofficial-mirrors/mattermost-platform | Go | 58 lines
                    
10
                    
11func TestUserAccessTokenJson(t *testing.T) {
                    
12	a1 := UserAccessToken{}
                    
31
                    
32func TestUserAccessTokenIsValid(t *testing.T) {
                    
33	ad := UserAccessToken{}
                    
38
                    
39	ad.Id = NewRandomString(26)
                    
40	if err := ad.IsValid(); err == nil || err.Id != "model.user_access_token.is_valid.token.app_error" {
                    
43
                    
44	ad.Token = NewRandomString(26)
                    
45	if err := ad.IsValid(); err == nil || err.Id != "model.user_access_token.is_valid.user_id.app_error" {
                    
48
                    
49	ad.UserId = NewRandomString(26)
                    
50	if err := ad.IsValid(); err != nil {
                    
                
networks_test.go https://gitlab.com/unofficial-mirrors/openshift-origin | Go | 73 lines
                    
13
                    
14func TestNetworksList(t *testing.T) {
                    
15	client, err := clients.NewNetworkV2Client()
                    
41
                    
42func TestNetworksCRUD(t *testing.T) {
                    
43	client, err := clients.NewNetworkV2Client()
                    
56
                    
57	newName := tools.RandomString("TESTACC-", 8)
                    
58	updateOpts := &networks.UpdateOpts{
                    
                
volumeattach_test.go https://gitlab.com/Red54/machine | Go | 125 lines
                    
17
                    
18func newBlockClient(t *testing.T) (*gophercloud.ServiceClient, error) {
                    
19	ao, err := openstack.AuthOptionsFromEnv()
                    
29
                    
30func createVAServer(t *testing.T, computeClient *gophercloud.ServiceClient, choices *ComputeChoices) (*servers.Server, error) {
                    
31	if testing.Short() {
                    
34
                    
35	name := tools.RandomString("ACPTTEST", 16)
                    
36	t.Logf("Attempting to create server: %s\n", name)
                    
54
                    
55func createVAVolume(t *testing.T, blockClient *gophercloud.ServiceClient) (*volumes.Volume, error) {
                    
56	volume, err := volumes.Create(blockClient, &volumes.CreateOpts{
                    
68
                    
69func createVolumeAttachment(t *testing.T, computeClient *gophercloud.ServiceClient, blockClient *gophercloud.ServiceClient, serverId string, volumeId string) {
                    
70	va, err := volumeattach.Create(computeClient, serverId, &volumeattach.CreateOpts{
                    
                
handshake_messages_test.go https://code.google.com/p/go/ | Go | 247 lines
                    
34
                    
35func TestMarshalUnmarshal(t *testing.T) {
                    
36	rand := rand.New(rand.NewSource(0))
                    
82
                    
83func TestFuzz(t *testing.T) {
                    
84	rand := rand.New(rand.NewSource(0))
                    
104
                    
105func randomString(n int, rand *rand.Rand) string {
                    
106	b := randomBytes(n, rand)
                    
123	if rand.Intn(10) > 5 {
                    
124		m.serverName = randomString(rand.Intn(255), rand)
                    
125	}
                    
158		for i := 0; i < n; i++ {
                    
159			m.nextProtos[i] = randomString(20, rand)
                    
160		}
                    
                
 

Source

Language