100+ results for '*testing.T randomstring'
Not the results you expected?
tasks_bitbucket_test.go (https://github.com/ovh/cds.git) Go · 3079 lines
11 )
13 func Test_doWebHookExecutionBitbucket(t *testing.T) {
14 log.SetLogger(t)
15 s, cancel := setupTestHookService(t)
16 defer cancel()
17 task := &sdk.TaskExecution{
18 UUID: sdk.RandomString(10),
19 Type: TypeRepoManagerWebHook,
20 WebHook: &sdk.WebHookExecution{
36 }
38 func Test_doWebHookExecutionBitbucketPRReviewerUpdated(t *testing.T) {
39 log.SetLogger(t)
40 s, cancel := setupTestHookService(t)
workflow_run_event_test.go (https://github.com/ovh/cds.git) Go · 572 lines
24 // Test ResyncCommitStatus with a notification where all is disabled.
25 // Must: no error returned, only list status is called
26 func TestResyncCommitStatusNotifDisabled(t *testing.T) {
27 db, cache := test.SetupPG(t)
29 ctx := context.TODO()
31 pkey := sdk.RandomString(10)
32 proj := assets.InsertTestProject(t, db, cache, pkey, pkey)
33 vcsServer := sdk.ProjectVCSServerLink{
41 // Create Application
42 app := sdk.Application{
43 Name: sdk.RandomString(10),
44 ProjectID: proj.ID,
45 RepositoryFullname: "foo/myrepo",
resource_arm_storage_container_test.go (https://github.com/terraform-providers/terraform-provider-azurerm.git) Go · 533 lines
14 )
16 func TestAccAzureRMStorageContainer_basic(t *testing.T) {
17 data := acceptance.BuildTestData(t, "azurerm_storage_container", "test")
33 }
35 func TestAccAzureRMStorageContainer_deleteAndRecreate(t *testing.T) {
36 data := acceptance.BuildTestData(t, "azurerm_storage_container", "test")
62 }
64 func TestAccAzureRMStorageContainer_basicAzureADAuth(t *testing.T) {
65 data := acceptance.BuildTestData(t, "azurerm_storage_container", "test")
policy_remediation_resource_test.go (https://github.com/terraform-providers/terraform-provider-azurerm.git) Go · 727 lines
14 )
16 func TestAccAzureRMPolicyRemediation_atSubscription(t *testing.T) {
17 data := acceptance.BuildTestData(t, "azurerm_policy_remediation", "test")
35 }
37 func TestAccAzureRMPolicyRemediation_atSubscriptionWithDefinitionSet(t *testing.T) {
38 data := acceptance.BuildTestData(t, "azurerm_policy_remediation", "test")
57 }
59 func TestAccAzureRMPolicyRemediation_atResourceGroup(t *testing.T) {
60 data := acceptance.BuildTestData(t, "azurerm_policy_remediation", "test")
kusto_cluster_resource_test.go (https://github.com/terraform-providers/terraform-provider-azurerm.git) Go · 702 lines
74 }
76 func TestAccAzureRMKustoCluster_withTags(t *testing.T) {
77 data := acceptance.BuildTestData(t, "azurerm_kusto_cluster", "test")
315 }
316 }
317 `, data.RandomInteger, data.Locations.Primary, data.RandomString)
318 }
642 }
643 }
644 `, data.RandomInteger, data.Locations.Primary, data.RandomString, data.RandomString, data.RandomString, data.RandomString, data.RandomString, data.RandomString)
645 }
hdinsight_storm_cluster_resource_test.go (https://github.com/terraform-providers/terraform-provider-azurerm.git) Go · 1116 lines
9 )
11 func TestAccAzureRMHDInsightStormCluster_basic(t *testing.T) {
12 data := acceptance.BuildTestData(t, "azurerm_hdinsight_storm_cluster", "test")
13 resource.ParallelTest(t, resource.TestCase{
35 }
37 func TestAccAzureRMHDInsightStormCluster_requiresImport(t *testing.T) {
38 data := acceptance.BuildTestData(t, "azurerm_hdinsight_storm_cluster", "test")
56 }
58 func TestAccAzureRMHDInsightStormCluster_update(t *testing.T) {
59 data := acceptance.BuildTestData(t, "azurerm_hdinsight_storm_cluster", "test")
60 resource.ParallelTest(t, resource.TestCase{
lbaas_v2.go (https://github.com/gophercloud/gophercloud.git) Go · 426 lines
19 // port with a random name. An error will be returned if the listener could not
20 // be created.
21 func CreateListener(t *testing.T, client *gophercloud.ServiceClient, lb *loadbalancers.LoadBalancer) (*listeners.Listener, error) {
22 listenerName := tools.RandomString("TESTACCT-", 8)
23 listenerDescription := tools.RandomString("TESTACCT-DESC-", 8)
24 listenerPort := tools.RandomInt(1, 100)
56 // CreateLoadBalancer will create a load balancer with a random name on a given
57 // subnet. An error will be returned if the loadbalancer could not be created.
58 func CreateLoadBalancer(t *testing.T, client *gophercloud.ServiceClient, subnetID string) (*loadbalancers.LoadBalancer, error) {
59 lbName := tools.RandomString("TESTACCT-", 8)
60 lbDescription := tools.RandomString("TESTACCT-DESC-", 8)
62 t.Logf("Attempting to create loadbalancer %s on subnet %s", lbName, subnetID)
networking.go (https://github.com/gophercloud/gophercloud.git) Go · 568 lines
23 // CreateNetwork will create basic network. An error will be returned if the
24 // network could not be created.
25 func CreateNetwork(t *testing.T, client *gophercloud.ServiceClient) (*networks.Network, error) {
26 networkName := tools.RandomString("TESTACC-", 8)
27 networkDescription := tools.RandomString("TESTACC-DESC-", 8)
28 createOpts := networks.CreateOpts{
29 Name: networkName,
49 // CreateNetworkWithoutPortSecurity will create a network without port security.
50 // An error will be returned if the network could not be created.
51 func CreateNetworkWithoutPortSecurity(t *testing.T, client *gophercloud.ServiceClient) (*networks.Network, error) {
52 networkName := tools.RandomString("TESTACC-", 8)
78 // CreatePort will create a port on the specified subnet. An error will be
79 // returned if the port could not be created.
80 func CreatePort(t *testing.T, client *gophercloud.ServiceClient, networkID, subnetID string) (*ports.Port, error) {
81 portName := tools.RandomString("TESTACC-", 8)
loadbalancer.go (https://github.com/gophercloud/gophercloud.git) Go · 546 lines
19 // port with a random name. An error will be returned if the listener could not
20 // be created.
21 func CreateListener(t *testing.T, client *gophercloud.ServiceClient, lb *loadbalancers.LoadBalancer) (*listeners.Listener, error) {
22 listenerName := tools.RandomString("TESTACCT-", 8)
23 listenerDescription := tools.RandomString("TESTACCT-DESC-", 8)
24 listenerPort := tools.RandomInt(1, 100)
57 // balancer on a random port with a random name. An error will be returned
58 // if the listener could not be created.
59 func CreateListenerHTTP(t *testing.T, client *gophercloud.ServiceClient, lb *loadbalancers.LoadBalancer) (*listeners.Listener, error) {
60 listenerName := tools.RandomString("TESTACCT-", 8)
61 listenerDescription := tools.RandomString("TESTACCT-DESC-", 8)
62 listenerPort := tools.RandomInt(1, 100)
keymanager.go (https://github.com/gophercloud/gophercloud.git) Go · 764 lines
25 // CreateAsymmetric Order will create a random asymmetric order.
26 // An error will be returned if the order could not be created.
27 func CreateAsymmetricOrder(t *testing.T, client *gophercloud.ServiceClient) (*orders.Order, error) {
28 name := tools.RandomString("TESTACC-", 8)
70 // CreateCertificateContainer will create a random certificate container.
71 // An error will be returned if the container could not be created.
72 func CreateCertificateContainer(t *testing.T, client *gophercloud.ServiceClient, passphrase, private, certificate *secrets.Secret) (*containers.Container, error) {
73 containerName := tools.RandomString("TESTACC-", 8)
121 // CreateKeyOrder will create a random key order.
122 // An error will be returned if the order could not be created.
123 func CreateKeyOrder(t *testing.T, client *gophercloud.ServiceClient) (*orders.Order, error) {
124 name := tools.RandomString("TESTACC-", 8)
163 // CreateRSAContainer will create a random RSA container.
164 // An error will be returned if the container could not be created.
165 func CreateRSAContainer(t *testing.T, client *gophercloud.ServiceClient, passphrase, private, public *secrets.Secret) (*containers.Container, error) {
166 containerName := tools.RandomString("TESTACC-", 8)
consumer_test.go (https://github.com/ovh/cds.git) Go · 494 lines
19 // Given a consumer with two groups, if we invalidate one it should be invalidated and one warning should be set.
20 func TestConsumerInvalidateGroupForUser_InvalidateOneConsumerGroup(t *testing.T) {
21 db, _ := test.SetupPG(t, bootstrap.InitiliazeDB)
25 u := sdk.AuthentifiedUser{
26 Username: sdk.RandomString(10),
27 }
28 require.NoError(t, user.Insert(context.TODO(), db, &u))
33 c := sdk.AuthConsumer{
34 Name: sdk.RandomString(10),
35 Description: sdk.RandomString(10),
58 // Given a consumer with two groups, if we invalidate one it should not be invalidated if the user is an admin.
59 func TestConsumerInvalidateGroupForUser_InvalidateOneConsumerGroupForAdmin(t *testing.T) {
60 db, _ := test.SetupPG(t, bootstrap.InitiliazeDB)
router_middleware_auth_permission_test.go (https://github.com/ovh/cds.git) Go · 1079 lines
83 authUser, _ := assets.InsertLambdaUser(t, db, g)
85 p := assets.InsertTestProject(t, db, api.Cache, sdk.RandomString(10), sdk.RandomString(10))
87 require.NoError(t, group.InsertLinkGroupUser(context.TODO(), db, &group.LinkGroupUser{
379 }
381 func Test_checkSessionPermissions(t *testing.T) {
382 api, db, _ := newTestAPI(t)
472 api, db, _ := newTestAPI(t)
474 g := assets.InsertTestGroup(t, db, sdk.RandomString(10))
475 defer func() {
476 assets.DeleteTestGroup(t, db, g)
http_test.go (https://github.com/scottleedavis/mattermost-plugin-remind.git) Go · 1058 lines
assert.go (https://github.com/blend/go-sdk.git) Go · 1185 lines
30 a := Assertions{
31 OutputFormat: OutputFormatFromEnv(),
32 Context: WithContextID(context.Background(), randomString(8)),
33 }
34 for _, opt := range opts {
40 // New returns a new instance of `Assertions`.
41 func New(t *testing.T, opts ...Option) *Assertions {
42 a := Assertions{
43 T: t,
44 OutputFormat: OutputFormatFromEnv(),
45 Context: WithContextID(context.Background(), randomString(8)),
46 }
47 if t != nil {
DDMFormTestUtil.java (https://github.com/danielreuther/liferay-portal.git) Java · 320 lines
helpers_linux_test.go (https://gitlab.com/Lin0x/oz) Go · 264 lines
25 }
27 func Test_NetInterfaceNameValid(t *testing.T) {
28 for _, tt := range ifcNameTests {
29 ret, _ := NetInterfaceNameValid(tt.ifcName)
51 nil},
52 {testLink{name: "ifc03", linkType: "dummy"},
53 LinkOptions{MacAddr: "fa:de:b0:99:52:1c"}, "randomstring",
54 nil},
55 }
57 func Test_FindInterfaceByMacAddress(t *testing.T) {
58 for _, tt := range ifcMacTests {
59 tl := &testLink{}
bulk_processor_test.go (https://gitlab.com/vantruong/GolangRestAPI) Go · 421 lines
13 )
15 func TestBulkProcessorDefaults(t *testing.T) {
16 client := setupTestClientAndCreateIndex(t)
40 }
42 func TestBulkProcessorCommitOnBulkActions(t *testing.T) {
43 //client := setupTestClientAndCreateIndexAndLog(t, SetTraceLog(log.New(os.Stdout, "", 0)))
44 client := setupTestClientAndCreateIndex(t)
63 }
65 func TestBulkProcessorCommitOnBulkSize(t *testing.T) {
66 //client := setupTestClientAndCreateIndexAndLog(t, SetTraceLog(log.New(os.Stdout, "", 0)))
67 client := setupTestClientAndCreateIndex(t)
session_test.go (https://gitlab.com/tamasd/ab) Go · 130 lines
38 }
40 func randomString(length int) string {
41 buf := make([]byte, length)
42 rand.Read(buf)
52 }
54 func TestEncDec(t *testing.T) {
55 Convey("Tests encoding and decoding the cookie data", t, func() {
56 key := getSecretKey()
69 }
71 func TestHTTPScenario(t *testing.T) {
72 Convey("Given a simple HTTP scenario", t, func() {
73 key := getSecretKey()
lbaas_v2.go (https://gitlab.com/unofficial-mirrors/openshift-origin) Go · 282 lines
20 // port with a random name. An error will be returned if the listener could not
21 // be created.
22 func CreateListener(t *testing.T, client *gophercloud.ServiceClient, lb *loadbalancers.LoadBalancer) (*listeners.Listener, error) {
23 listenerName := tools.RandomString("TESTACCT-", 8)
49 // CreateLoadBalancer will create a load balancer with a random name on a given
50 // subnet. An error will be returned if the loadbalancer could not be created.
51 func CreateLoadBalancer(t *testing.T, client *gophercloud.ServiceClient, subnetID string) (*loadbalancers.LoadBalancer, error) {
52 lbName := tools.RandomString("TESTACCT-", 8)
79 // CreateMember will create a member with a random name, port, address, and
80 // weight. An error will be returned if the member could not be created.
81 func 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)
116 // CreateMonitor will create a monitor with a random name for a specific pool.
117 // An error will be returned if the monitor could not be created.
118 func CreateMonitor(t *testing.T, client *gophercloud.ServiceClient, lb *loadbalancers.LoadBalancer, pool *pools.Pool) (*monitors.Monitor, error) {
119 monitorName := tools.RandomString("TESTACCT-", 8)
node_test.go (https://gitlab.com/JamesClonk/machine) Go · 175 lines
random_data_test.go (https://gitlab.com/ezeql/go-randomdata) Go · 257 lines
7 )
9 func TestRandomStringDigits(t *testing.T) {
10 t.Log("TestRandomStringDigits")
27 }
29 func TestFirstName(t *testing.T) {
30 t.Log("TestFirstName")
31 firstNameMale := FirstName(Male)
47 }
49 func TestLastName(t *testing.T) {
50 t.Log("TestLastName")
51 lastName := LastName()
56 }
58 func TestFullName(t *testing.T) {
59 t.Log("TestFullName")
identity.go (https://github.com/gophercloud/gophercloud.git) Go · 397 lines
21 // has so many options. An error will be returned if the project was
22 // unable to be created.
23 func CreateProject(t *testing.T, client *gophercloud.ServiceClient, c *projects.CreateOpts) (*projects.Project, error) {
24 name := tools.RandomString("ACPTTEST", 8)
25 description := tools.RandomString("ACPTTEST-DESC", 8)
26 t.Logf("Attempting to create project: %s", name)
53 // has so many options. An error will be returned if the user was
54 // unable to be created.
55 func CreateUser(t *testing.T, client *gophercloud.ServiceClient, c *users.CreateOpts) (*users.User, error) {
56 name := tools.RandomString("ACPTTEST", 8)
82 // has so many options. An error will be returned if the group was
83 // unable to be created.
84 func CreateGroup(t *testing.T, client *gophercloud.ServiceClient, c *groups.CreateOpts) (*groups.Group, error) {
85 name := tools.RandomString("ACPTTEST", 8)
extensions.go (https://gitlab.com/unofficial-mirrors/openshift-origin) Go · 173 lines
17 // CreateUploadImage will upload volume it as volume-baked image. An name of new image or err will be
18 // returned
19 func CreateUploadImage(t *testing.T, client *gophercloud.ServiceClient, volume *volumes.Volume) (volumeactions.VolumeImage, error) {
20 if testing.Short() {
21 t.Skip("Skipping test that requires volume-backed image uploading in short mode.")
22 }
24 imageName := tools.RandomString("ACPTTEST", 16)
25 uploadImageOpts := volumeactions.UploadImageOpts{
26 ImageName: imageName,
47 // DeleteUploadedImage deletes uploaded image. An error will be returned
48 // if the deletion request failed.
49 func DeleteUploadedImage(t *testing.T, client *gophercloud.ServiceClient, imageName string) error {
50 if testing.Short() {
51 t.Skip("Skipping test that requires volume-backed image removing in short mode.")
poll_test.go (https://github.com/matterpoll/matterpoll.git) Go · 799 lines
25 question := model.NewRandomString(10)
26 answerOptions := []string{model.NewRandomString(10), model.NewRandomString(10), model.NewRandomString(10)}
27 p, err := poll.NewPoll(creator, question, answerOptions, poll.Settings{
28 Anonymous: true,
54 question := model.NewRandomString(10)
55 answerOptions := []string{model.NewRandomString(10), model.NewRandomString(10), model.NewRandomString(10)}
56 p, err := poll.NewPoll(creator, question, answerOptions, poll.Settings{
57 Anonymous: true,
201 }
203 func TestAddAnswerOption(t *testing.T) {
204 assert := assert.New(t)
217 assert.NotNil(err)
218 })
219 t.Run("dublicant options with spaces", func(t *testing.T) {
220 p := testutils.GetPollWithVotes()
handshake_messages_test.go (https://gitlab.com/JamesClonk/machine) Go · 246 lines
33 }
35 func TestMarshalUnmarshal(t *testing.T) {
36 rand := rand.New(rand.NewSource(0))
81 }
83 func TestFuzz(t *testing.T) {
84 rand := rand.New(rand.NewSource(0))
85 for _, iface := range tests {
103 }
105 func randomString(n int, rand *rand.Rand) string {
106 b := randomBytes(n, rand)
107 return string(b)
DDMFormTestUtil.java (https://github.com/kiyoshilee/liferay-portal.git) Java · 283 lines
router_middleware_auth_test.go (https://github.com/ovh/cds.git) Go · 223 lines
18 )
20 func Test_authMiddleware_WithAuth(t *testing.T) {
21 api, db, _ := newTestAPI(t)
38 assert.Equal(t, u.ID, getAPIConsumer(ctx).AuthentifiedUserID)
40 req = assets.NewJWTAuthentifiedRequest(t, sdk.RandomString(10), http.MethodGet, "", nil)
41 w = httptest.NewRecorder()
42 ctx, err = api.authMiddleware(context.TODO(), w, req, config)
44 }
46 func Test_authMiddleware_WithAuthConsumerDisabled(t *testing.T) {
47 api, db, _ := newTestAPI(t)
file_test.go (https://gitlab.com/unofficial-mirrors/mattermost-platform) Go · 163 lines
18 )
20 func TestGeneratePublicLinkHash(t *testing.T) {
21 filename1 := model.NewId() + "/" + model.NewRandomString(16) + ".txt"
22 filename2 := model.NewId() + "/" + model.NewRandomString(16) + ".txt"
23 salt1 := model.NewRandomString(32)
24 salt2 := model.NewRandomString(32)
26 hash1 := GeneratePublicLinkHash(filename1, salt1)
41 }
43 func TestDoUploadFile(t *testing.T) {
44 th := Setup()
45 defer th.TearDown()
lb_test.go (https://gitlab.com/JamesClonk/machine) Go · 214 lines
15 )
17 func TestLBs(t *testing.T) {
18 client := setup(t)
42 }
44 func createLB(t *testing.T, client *gophercloud.ServiceClient, count int) []int {
45 ids := []int{}
47 for i := 0; i < count; i++ {
48 opts := lbs.CreateOpts{
49 Name: tools.RandomString("test_", 5),
50 Port: 80,
51 Protocol: "HTTP",
handshake_messages_test.go (https://bitbucket.org/pizzafactory/pf-gcc.git) Go · 202 lines
30 }
32 func TestMarshalUnmarshal(t *testing.T) {
33 rand := rand.New(rand.NewSource(0))
34 for i, iface := range tests {
72 }
74 func TestFuzz(t *testing.T) {
75 rand := rand.New(rand.NewSource(0))
76 for _, iface := range tests {
94 }
96 func randomString(n int, rand *rand.Rand) string {
97 b := randomBytes(n, rand)
98 return string(b)
pipeline_importer_test.go (https://github.com/ovh/cds.git) Go · 659 lines
29 args args
30 wantErr bool
31 setup func(t *testing.T, args args)
32 asserts func(t *testing.T, pip sdk.Pipeline)
33 tearDown func(t *testing.T, args args)
34 }
36 func testImportUpdate(t *testing.T, db gorp.SqlExecutor, store cache.Store, tt testcase) {
37 msgChan := make(chan sdk.Message, 1)
38 done := make(chan bool)
75 }
77 func TestImportUpdate(t *testing.T) {
78 db, cache := test.SetupPG(t, bootstrap.InitiliazeDB)
secgroup_test.go (https://gitlab.com/unofficial-mirrors/openshift-origin) Go · 137 lines
11 )
13 func TestSecGroupsList(t *testing.T) {
14 client, err := clients.NewComputeV2Client()
15 if err != nil {
32 }
34 func TestSecGroupsCreate(t *testing.T) {
35 client, err := clients.NewComputeV2Client()
36 if err != nil {
45 }
47 func TestSecGroupsUpdate(t *testing.T) {
48 client, err := clients.NewComputeV2Client()
49 if err != nil {
domains_test.go (https://gitlab.com/github-cloud-corporation/dex) Go · 96 lines
10 )
12 func TestGetDomains(t *testing.T) {
13 domain := reqEnv(t, "MG_DOMAIN")
14 apiKey := reqEnv(t, "MG_API_KEY")
24 }
26 func TestGetSingleDomain(t *testing.T) {
27 domain := reqEnv(t, "MG_DOMAIN")
28 apiKey := reqEnv(t, "MG_API_KEY")
46 }
48 func TestGetSingleDomainNotExist(t *testing.T) {
49 domain := reqEnv(t, "MG_DOMAIN")
50 apiKey := reqEnv(t, "MG_API_KEY")
application_deployment_test.go (https://github.com/ovh/cds.git) Go · 371 lines
29 proj := assets.InsertTestProject(t, db, api.Cache, pkey, pkey)
30 app := &sdk.Application{
31 Name: sdk.RandomString(10),
32 }
33 test.NoError(t, application.Insert(db, *proj, app))
172 }
174 func Test_postApplicationDeploymentStrategyConfigHandler_InsertTwoDifferentIntegrations(t *testing.T) {
175 api, db, router := newTestAPI(t)
298 require.NoError(t, err)
300 _, jws, err := builtin.NewConsumer(context.TODO(), db, sdk.RandomString(10), sdk.RandomString(10), localConsumer, u.GetGroupIDs(),
301 sdk.NewAuthConsumerScopeDetails(sdk.AuthConsumerScopeProject))
layer3.go (https://gitlab.com/unofficial-mirrors/openshift-origin) Go · 250 lines
14 // CreateFloatingIP creates a floating IP on a given network and port. An error
15 // will be returned if the creation failed.
16 func 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)
35 // the OS_EXTGW_ID environment variable to be set. An error is returned if the
36 // creation failed.
37 func CreateExternalRouter(t *testing.T, client *gophercloud.ServiceClient) (*routers.Router, error) {
38 var router *routers.Router
39 choices, err := clients.AcceptanceTestChoicesFromEnv()
42 }
44 routerName := tools.RandomString("TESTACC-", 8)
46 t.Logf("Attempting to create external router: %s", routerName)
codec_test.go (https://github.com/apache/rocketmq-client-go.git) Go · 368 lines
36 properties := make(map[string]string)
37 for i := 0; i < 10; i++ {
38 properties[randomString(rand.Intn(20))] = randomString(rand.Intn(20))
39 }
40 return properties
49 }
51 func randomString(length int) string {
52 bs := make([]byte, length)
53 for i := 0; i < len(bs); i++ {
63 }
65 func Test_encode(t *testing.T) {
66 for i := 0; i < 1000; i++ {
67 rc := randomNewRemotingCommand()
jenkins_test.go (https://gitlab.com/Kravcenko/gojenkins) Go · 178 lines
data_factory_dataset_json_resource_test.go (https://github.com/terraform-providers/terraform-provider-azurerm.git) Go · 374 lines
13 )
15 func TestAccAzureRMDataFactoryDatasetJSON_basic(t *testing.T) {
16 data := acceptance.BuildTestData(t, "azurerm_data_factory_dataset_json", "test")
32 }
34 func TestAccAzureRMDataFactoryDatasetJSON_update(t *testing.T) {
35 data := acceptance.BuildTestData(t, "azurerm_data_factory_dataset_json", "test")
298 }
300 func TestAccAzureRMDataFactoryDatasetJSON_blob(t *testing.T) {
301 data := acceptance.BuildTestData(t, "azurerm_data_factory_dataset_json", "test")
loadbalancer.go (https://github.com/cnych/opdemo.git) Go · 463 lines
22 // port with a random name. An error will be returned if the listener could not
23 // be created.
24 func CreateListener(t *testing.T, client *gophercloud.ServiceClient, lb *loadbalancers.LoadBalancer) (*listeners.Listener, error) {
25 listenerName := tools.RandomString("TESTACCT-", 8)
26 listenerDescription := tools.RandomString("TESTACCT-DESC-", 8)
27 listenerPort := tools.RandomInt(1, 100)
59 // CreateLoadBalancer will create a load balancer with a random name on a given
60 // subnet. An error will be returned if the loadbalancer could not be created.
61 func CreateLoadBalancer(t *testing.T, client *gophercloud.ServiceClient, subnetID string, tags []string) (*loadbalancers.LoadBalancer, error) {
62 lbName := tools.RandomString("TESTACCT-", 8)
63 lbDescription := tools.RandomString("TESTACCT-DESC-", 8)
65 t.Logf("Attempting to create loadbalancer %s on subnet %s", lbName, subnetID)
iothub_fallback_route_resource_test.go (https://github.com/terraform-providers/terraform-provider-azurerm.git) Go · 252 lines
16 // since a fallback route is created by default
18 func TestAccAzureRMIotHubFallbackRoute_basic(t *testing.T) {
19 data := acceptance.BuildTestData(t, "azurerm_iothub_fallback_route", "test")
35 }
37 func TestAccAzureRMIotHubFallbackRoute_update(t *testing.T) {
38 data := acceptance.BuildTestData(t, "azurerm_iothub_fallback_route", "test")
185 enabled = true
186 }
187 `, data.RandomInteger, data.Locations.Primary, data.RandomString)
188 }
file_test.go (https://gitlab.com/ricardo.hernandez/telegraf) Go · 196 lines
21 )
23 func TestFileExistingFile(t *testing.T) {
24 fh := createFile()
25 s, _ := serializers.NewInfluxSerializer()
41 }
43 func TestFileNewFile(t *testing.T) {
44 s, _ := serializers.NewInfluxSerializer()
45 fh := tmpFile()
61 }
63 func TestFileExistingFiles(t *testing.T) {
64 fh1 := createFile()
65 fh2 := createFile()
kusto_database_resource_test.go (https://github.com/terraform-providers/terraform-provider-azurerm.git) Go · 309 lines
12 )
14 func TestAccAzureRMKustoDatabase_basic(t *testing.T) {
15 data := acceptance.BuildTestData(t, "azurerm_kusto_database", "test")
31 }
33 func TestAccAzureRMKustoDatabase_softDeletePeriod(t *testing.T) {
34 data := acceptance.BuildTestData(t, "azurerm_kusto_database", "test")
57 }
59 func TestAccAzureRMKustoDatabase_hotCachePeriod(t *testing.T) {
60 data := acceptance.BuildTestData(t, "azurerm_kusto_database", "test")
nodegroups_test.go (https://github.com/gophercloud/gophercloud.git) Go · 172 lines
15 )
17 func TestNodeGroupsCRUD(t *testing.T) {
18 // API not available until Magnum train
19 clients.SkipRelease(t, "stable/mitaka")
40 var nodeGroupID string
42 t.Run("list", func(t *testing.T) { testNodeGroupsList(t, client, clusterID) })
43 t.Run("listone-get", func(t *testing.T) { testNodeGroupGet(t, client, clusterID) })
44 t.Run("create", func(t *testing.T) { nodeGroupID = testNodeGroupCreate(t, client, clusterID) })
46 t.Logf("Created nodegroup: %s", nodeGroupID)
56 th.AssertNoErr(t, err)
58 t.Run("update", func(t *testing.T) { testNodeGroupUpdate(t, client, clusterID, nodeGroupID) })
59 t.Run("delete", func(t *testing.T) { testNodeGroupDelete(t, client, clusterID, nodeGroupID) })
identity.go (https://gitlab.com/unofficial-mirrors/openshift-origin) Go · 186 lines
15 // AddUserRole will grant a role to a user in a tenant. An error will be
16 // returned if the grant was unsuccessful.
17 func 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)
32 // has so many options. An error will be returned if the project was
33 // unable to be created.
34 func CreateTenant(t *testing.T, client *gophercloud.ServiceClient, c *tenants.CreateOpts) (*tenants.Tenant, error) {
35 name := tools.RandomString("ACPTTEST", 8)
58 // CreateUser will create a user with a random name and adds them to the given
59 // tenant. An error will be returned if the user was unable to be created.
60 func CreateUser(t *testing.T, client *gophercloud.ServiceClient, tenant *tenants.Tenant) (*users.User, error) {
61 userName := tools.RandomString("user_", 5)
81 // the tenant ID failed to be deleted. This works best when using it as
82 // a deferred function.
83 func DeleteTenant(t *testing.T, client *gophercloud.ServiceClient, tenantID string) {
84 err := tenants.Delete(client, tenantID).ExtractErr()
85 if err != nil {
helpers_test.go (https://gitlab.com/epicglue/epicglue) Go · 141 lines
30 //}
32 func TestRandomString(t *testing.T) {
33 r1 := helpers.RandomString(8)
34 assert.Len(t, r1, 8)
36 r2 := helpers.RandomString(8)
37 assert.Len(t, r2, 8)
59 }
61 func TestFlattenArrayOfStrings(t *testing.T) {
62 assert.Equal(t, "[]", helpers.FlattenArrayOfStrings([]string{}))
63 assert.Equal(t, `["1"]`, helpers.FlattenArrayOfStrings([]string{"1"}))
76 }
78 func TestStringToFloat64(t *testing.T) {
79 assert.Equal(t, helpers.StringToFloat64("4.11"), float64(4.11))
80 }
resource_arm_hpc_cache_blob_target_test.go (https://github.com/terraform-providers/terraform-provider-azurerm.git) Go · 240 lines
14 )
16 func TestAccAzureRMHPCCacheBlobTarget_basic(t *testing.T) {
17 data := acceptance.BuildTestData(t, "azurerm_hpc_cache_blob_target", "test")
33 }
35 func TestAccAzureRMHPCCacheBlobTarget_update(t *testing.T) {
36 data := acceptance.BuildTestData(t, "azurerm_hpc_cache_blob_target", "test")
237 principal_id = data.azuread_service_principal.test.object_id
238 }
239 `, data.RandomInteger, data.Locations.Primary, data.RandomInteger, data.RandomInteger, data.RandomInteger, data.RandomString, data.RandomString)
240 }
counter_integration_test.go (https://gitlab.com/epicglue/epicglue) Go · 124 lines
extensions.go (https://gitlab.com/unofficial-mirrors/openshift-origin) Go · 142 lines
15 // CreateExternalNetwork will create an external network. An error will be
16 // returned if the creation failed.
17 func CreateExternalNetwork(t *testing.T, client *gophercloud.ServiceClient) (*networks.Network, error) {
18 networkName := tools.RandomString("TESTACC-", 8)
45 // CreatePortWithSecurityGroup will create a port with a security group
46 // attached. An error will be returned if the port could not be created.
47 func CreatePortWithSecurityGroup(t *testing.T, client *gophercloud.ServiceClient, networkID, subnetID, secGroupID string) (*ports.Port, error) {
48 portName := tools.RandomString("TESTACC-", 8)
71 // CreateSecurityGroup will create a security group with a random name.
72 // An error will be returned if one was failed to be created.
73 func CreateSecurityGroup(t *testing.T, client *gophercloud.ServiceClient) (*groups.SecGroup, error) {
74 secGroupName := tools.RandomString("TESTACC-", 8)
93 // and random port between 80 and 99.
94 // An error will be returned if one was failed to be created.
95 func 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)
resource_aws_redshift_security_group_test.go (https://github.com/kris-nova/terraformctl.git) Go · 440 lines
13 )
15 func TestAccAWSRedshiftSecurityGroup_ingressCidr(t *testing.T) {
16 var v redshift.ClusterSecurityGroup
17 rInt := acctest.RandInt()
40 }
42 func TestAccAWSRedshiftSecurityGroup_updateIngressCidr(t *testing.T) {
43 var v redshift.ClusterSecurityGroup
44 rInt := acctest.RandInt()
79 }
81 func TestAccAWSRedshiftSecurityGroup_ingressSecurityGroup(t *testing.T) {
82 var v redshift.ClusterSecurityGroup
83 rInt := acctest.RandInt()
resource_arm_storage_share_directory_test.go (https://github.com/terraform-providers/terraform-provider-azurerm.git) Go · 351 lines
12 )
14 func TestAccAzureRMStorageShareDirectory_basic(t *testing.T) {
15 data := acceptance.BuildTestData(t, "azurerm_storage_share_directory", "test")
31 }
33 func TestAccAzureRMStorageShareDirectory_uppercase(t *testing.T) {
34 data := acceptance.BuildTestData(t, "azurerm_storage_share_directory", "test")
50 }
52 func TestAccAzureRMStorageShareDirectory_requiresImport(t *testing.T) {
53 data := acceptance.BuildTestData(t, "azurerm_storage_share_directory", "test")
db.go (https://gitlab.com/unofficial-mirrors/openshift-origin) Go · 145 lines
17 // CreateDatabase will create a database with a randomly generated name.
18 // An error will be returned if the database was unable to be created.
19 func CreateDatabase(t *testing.T, client *gophercloud.ServiceClient, instanceID string) error {
20 name := tools.RandomString("ACPTTEST", 8)
35 // OS_DATASTORE_TYPE_ID environment variable.
36 // An error will be returned if the instance was unable to be created.
37 func CreateInstance(t *testing.T, client *gophercloud.ServiceClient) (*instances.Instance, error) {
38 if testing.Short() {
39 t.Skip("Skipping test that requires instance creation in short mode.")
45 }
47 name := tools.RandomString("ACPTTEST", 8)
48 t.Logf("Attempting to create instance: %s", name)
72 // CreateUser will create a user with a randomly generated name.
73 // An error will be returned if the user was unable to be created.
74 func CreateUser(t *testing.T, client *gophercloud.ServiceClient, instanceID string) error {
75 name := tools.RandomString("ACPTTEST", 8)
lbaas.go (https://gitlab.com/unofficial-mirrors/openshift-origin) Go · 160 lines
15 // CreateMember will create a load balancer member in a specified pool on a
16 // random port. An error will be returned if the member could not be created.
17 func CreateMember(t *testing.T, client *gophercloud.ServiceClient, poolID string) (*members.Member, error) {
18 protocolPort := tools.RandomInt(100, 1000)
19 address := tools.RandomInt(2, 200)
38 // CreateMonitor will create a monitor with a random name for a specific pool.
39 // An error will be returned if the monitor could not be created.
40 func CreateMonitor(t *testing.T, client *gophercloud.ServiceClient) (*monitors.Monitor, error) {
41 t.Logf("Attempting to create monitor.")
61 // CreatePool will create a pool with a random name. An error will be returned
62 // if the pool could not be deleted.
63 func CreatePool(t *testing.T, client *gophercloud.ServiceClient, subnetID string) (*pools.Pool, error) {
64 poolName := tools.RandomString("TESTACCT-", 8)
86 // specified subnet and pool. An error will be returned if the vip could
87 // not be created.
88 func CreateVIP(t *testing.T, client *gophercloud.ServiceClient, subnetID, poolID string) (*vips.VirtualIP, error) {
89 vipName := tools.RandomString("TESTACCT-", 8)
env_test.go
(https://github.com/dotcloud/docker.git)
Go · 313 lines
✨ Summary
This is a test file for the Env package in Go. It contains various tests to ensure that the package works correctly and provides the expected functionality. The code includes unit tests, integration tests, and benchmarks to measure the performance of the package.
This is a test file for the Env package in Go. It contains various tests to ensure that the package works correctly and provides the expected functionality. The code includes unit tests, integration tests, and benchmarks to measure the performance of the package.
kusto_database_principal_assignment_resource_test.go (https://github.com/terraform-providers/terraform-provider-azurerm.git) Go · 183 lines
12 )
14 func TestAccAzureRMKustoDatabasePrincipalAssignment_basic(t *testing.T) {
15 data := acceptance.BuildTestData(t, "azurerm_kusto_database_principal_assignment", "test")
31 }
33 func TestAccAzureRMKustoDatabasePrincipalAssignment_requiresImport(t *testing.T) {
34 data := acceptance.BuildTestData(t, "azurerm_kusto_database_principal_assignment", "test")
161 role = "Viewer"
162 }
163 `, data.RandomInteger, data.Locations.Primary, data.RandomString, data.RandomInteger, data.RandomInteger)
164 }
manager_test.go (https://gitlab.com/epicglue/epicglue) Go · 396 lines
10 )
12 func TestManager_Get(t *testing.T) {
13 now := time.Now()
14 user := model.User{
83 }
85 func TestManager_All(t *testing.T) {
86 //now := time.Now()
87 //user := model.User{
156 }
158 //func TestDefaultDataManager_Channels(t *testing.T) {
159 // //suffix := helpers.RandomString(8)
194 //}
195 //
196 //func TestDefaultDataManager_Channel(t *testing.T) {
197 // suffix := helpers.RandomString(8)
user_assigned_identity_resource_test.go (https://github.com/terraform-providers/terraform-provider-azurerm.git) Go · 147 lines
14 )
16 func TestAccAzureRMUserAssignedIdentity_basic(t *testing.T) {
17 data := acceptance.BuildTestData(t, "azurerm_user_assigned_identity", "test")
34 })
35 }
36 func TestAccAzureRMUserAssignedIdentity_requiresImport(t *testing.T) {
37 data := acceptance.BuildTestData(t, "azurerm_user_assigned_identity", "test")
132 location = azurerm_resource_group.test.location
133 }
134 `, data.RandomInteger, data.Locations.Primary, data.RandomString)
135 }
monitor_log_profile_data_source_test.go (https://github.com/terraform-providers/terraform-provider-azurerm.git) Go · 152 lines
13 // (which our test suite can't easily workaround)
15 func testAccDataSourceAzureRMMonitorLogProfile_storageaccount(t *testing.T) {
16 data := acceptance.BuildTestData(t, "data.azurerm_monitor_log_profile", "test")
38 }
40 func testAccDataSourceAzureRMMonitorLogProfile_eventhub(t *testing.T) {
41 data := acceptance.BuildTestData(t, "data.azurerm_monitor_log_profile", "test")
104 name = azurerm_monitor_log_profile.test.name
105 }
106 `, data.RandomInteger, data.Locations.Primary, data.RandomString, data.RandomInteger, data.Locations.Primary)
107 }
kusto_attached_database_configuration_resource_test.go (https://github.com/terraform-providers/terraform-provider-azurerm.git) Go · 145 lines
12 )
14 func TestAccAzureRMKustoAttachedDatabaseConfiguration_basic(t *testing.T) {
15 data := acceptance.BuildTestData(t, "azurerm_kusto_attached_database_configuration", "test")
79 database_name = "*"
80 }
81 `, data.RandomInteger, data.Locations.Primary, data.RandomString, data.RandomString, data.RandomInteger, data.RandomInteger)
82 }
identity.go (https://gitlab.com/unofficial-mirrors/openshift-origin) Go · 326 lines
19 // has so many options. An error will be returned if the project was
20 // unable to be created.
21 func CreateProject(t *testing.T, client *gophercloud.ServiceClient, c *projects.CreateOpts) (*projects.Project, error) {
22 name := tools.RandomString("ACPTTEST", 8)
46 // has so many options. An error will be returned if the user was
47 // unable to be created.
48 func CreateUser(t *testing.T, client *gophercloud.ServiceClient, c *users.CreateOpts) (*users.User, error) {
49 name := tools.RandomString("ACPTTEST", 8)
73 // has so many options. An error will be returned if the group was
74 // unable to be created.
75 func CreateGroup(t *testing.T, client *gophercloud.ServiceClient, c *groups.CreateOpts) (*groups.Group, error) {
76 name := tools.RandomString("ACPTTEST", 8)
100 // has many options. An error will be returned if the domain was
101 // unable to be created.
102 func CreateDomain(t *testing.T, client *gophercloud.ServiceClient, c *domains.CreateOpts) (*domains.Domain, error) {
103 name := tools.RandomString("ACPTTEST", 8)
textGenerator_test.go (https://github.com/swagger-mock/swagger-mock.git) Go · 114 lines
11 )
13 func TestTextGenerator_GenerateDataBySchema_MaxLengthLessThanMinLength_Error(t *testing.T) {
14 textGeneratorInstance := &textGenerator{}
15 schema := openapi3.NewSchema()
24 }
26 func TestTextGenerator_GenerateDataBySchema_MaxLengthLessThan5_RandomStringOfGivenLength(t *testing.T) {
27 textGeneratorInstance := &textGenerator{}
28 schema := openapi3.NewSchema()
36 }
38 func TestTextGenerator_GenerateDataBySchema_MinAndMaxLength_LengthOfStringInRange(t *testing.T) {
39 randomSource := rand.NewSource(time.Now().UnixNano())
40 textGeneratorInstance := &textGenerator{
networking.go (https://gitlab.com/unofficial-mirrors/openshift-origin) Go · 246 lines
14 // CreateNetwork will create basic network. An error will be returned if the
15 // network could not be created.
16 func CreateNetwork(t *testing.T, client *gophercloud.ServiceClient) (*networks.Network, error) {
17 networkName := tools.RandomString("TESTACC-", 8)
34 // CreatePort will create a port on the specified subnet. An error will be
35 // returned if the port could not be created.
36 func CreatePort(t *testing.T, client *gophercloud.ServiceClient, networkID, subnetID string) (*ports.Port, error) {
37 portName := tools.RandomString("TESTACC-", 8)
67 // CreatePortWithNoSecurityGroup will create a port with no security group
68 // attached. An error will be returned if the port could not be created.
69 func CreatePortWithNoSecurityGroup(t *testing.T, client *gophercloud.ServiceClient, networkID, subnetID string) (*ports.Port, error) {
70 portName := tools.RandomString("TESTACC-", 8)
102 // CreateSubnet will create a subnet on the specified Network ID. An error
103 // will be returned if the subnet could not be created.
104 func CreateSubnet(t *testing.T, client *gophercloud.ServiceClient, networkID string) (*subnets.Subnet, error) {
105 subnetName := tools.RandomString("TESTACC-", 8)
clusterapi_autodiscovery_test.go (https://github.com/kubernetes/autoscaler.git) Go · 324 lines
205 }{{
206 name: "no clustername, namespace, or label selector specified should match any MachineSet",
207 testSpec: createTestSpec(RandomString(6), RandomString(6), RandomString(6), 1, false, nil),
208 autoDiscoveryConfig: &clusterAPIAutoDiscoveryConfig{labelSelector: labels.NewSelector()},
209 shouldMatch: true,
210 }, {
211 name: "no clustername, namespace, or label selector specified should match any MachineDeployment",
212 testSpec: createTestSpec(RandomString(6), RandomString(6), RandomString(6), 1, true, nil),
213 autoDiscoveryConfig: &clusterAPIAutoDiscoveryConfig{labelSelector: labels.NewSelector()},
214 shouldMatch: true,
242 }, {
243 name: "clustername specified does not match MachineDeployment, namespace matches, no labels specified",
244 testSpec: createTestSpec(RandomString(6), "foo", RandomString(6), 1, true, nil),
245 autoDiscoveryConfig: &clusterAPIAutoDiscoveryConfig{
246 clusterName: "foo",
rand_test.go (https://gitlab.com/unofficial-mirrors/kubernetes) Go · 114 lines
28 )
30 func TestString(t *testing.T) {
31 valid := "0123456789abcdefghijklmnopqrstuvwxyz"
32 for _, l := range []int{0, 1, 2, 10, 123} {
45 // Confirm that panic occurs on invalid input.
46 func TestRangePanic(t *testing.T) {
47 defer func() {
48 if err := recover(); err == nil {
54 }
56 func TestIntn(t *testing.T) {
57 // 0 is invalid.
58 for _, max := range []int{1, 2, 10, 123} {
secgroup_test.go (https://gitlab.com/Red54/machine) Go · 177 lines
14 )
16 func TestSecGroups(t *testing.T) {
17 client, err := newClient()
18 th.AssertNoErr(t, err)
24 listSecGroups(t, client)
26 newName := tools.RandomString("secgroup_", 5)
27 updateSecGroup(t, client, groupID, newName)
42 }
44 func createSecGroup(t *testing.T, client *gophercloud.ServiceClient) string {
45 opts := secgroups.CreateOpts{
46 Name: tools.RandomString("secgroup_", 5),
auth_consumer_test.go (https://github.com/ovh/cds.git) Go · 300 lines
18 )
20 func Test_getConsumersByUserHandler(t *testing.T) {
21 api, db, _ := newTestAPI(t)
26 require.NoError(t, err)
28 consumer, _, err := builtin.NewConsumer(context.TODO(), db, sdk.RandomString(10), "", localConsumer, nil,
29 sdk.NewAuthConsumerScopeDetails(sdk.AuthConsumerScopeUser))
30 require.NoError(t, err)
60 }
62 func Test_postConsumerByUserHandler(t *testing.T) {
63 api, db, _ := newTestAPI(t)
env_test.go (https://gitlab.com/Red54/machine) Go · 324 lines
25 }
27 func TestEnvLenDup(t *testing.T) {
28 env := &Env{
29 "foo=bar",
78 }
80 func TestSetenvBool(t *testing.T) {
81 job := mkJob(t, "dummy")
82 job.SetenvBool("foo", true)
164 res := make([][2]string, l)
165 for i := 0; i < l; i++ {
166 t := [2]string{testutils.RandomString(5), testutils.RandomString(20)}
167 res[i] = t
168 }
map_test.go (https://github.com/openSUSE/umoci.git) Go · 275 lines
32 func descriptorPtr(d ispec.Descriptor) *ispec.Descriptor { return &d }
34 func randomDescriptor(t *testing.T) ispec.Descriptor {
35 var descriptor ispec.Descriptor
45 n := rand.Intn(32)
46 for i := 0; i < n; i++ {
47 descriptor.Annotations[randomString(32)] = randomString(32)
48 }
53 // Make sure that an identity mapping doesn't change the struct, and that it
54 // actually does visit all of the descriptors once.
55 func TestMapDescriptors_Identity(t *testing.T) {
56 // List of interfaces to use MapDescriptors on, as well as how many
57 // *unique* descriptors they contain.
monitor_activity_log_alert_resource_test.go (https://github.com/terraform-providers/terraform-provider-azurerm.git) Go · 383 lines
12 )
14 func TestAccAzureRMMonitorActivityLogAlert_basic(t *testing.T) {
15 data := acceptance.BuildTestData(t, "azurerm_monitor_activity_log_alert", "test")
36 }
38 func TestAccAzureRMMonitorActivityLogAlert_requiresImport(t *testing.T) {
39 data := acceptance.BuildTestData(t, "azurerm_monitor_activity_log_alert", "test")
58 }
60 func TestAccAzureRMMonitorActivityLogAlert_singleResource(t *testing.T) {
61 data := acceptance.BuildTestData(t, "azurerm_monitor_activity_log_alert", "test")
dao_variable_test.go (https://github.com/ovh/cds.git) Go · 110 lines
fwaas.go (https://gitlab.com/unofficial-mirrors/openshift-origin) Go · 203 lines
16 // CreateFirewall will create a Firewaill with a random name and a specified
17 // policy ID. An error will be returned if the firewall could not be created.
18 func CreateFirewall(t *testing.T, client *gophercloud.ServiceClient, policyID string) (*firewalls.Firewall, error) {
19 firewallName := tools.RandomString("TESTACC-", 8)
46 // specified policy ID attached to a specified Router. An error will be
47 // returned if the firewall could not be created.
48 func CreateFirewallOnRouter(t *testing.T, client *gophercloud.ServiceClient, policyID string, routerID string) (*firewalls.Firewall, error) {
49 firewallName := tools.RandomString("TESTACC-", 8)
78 // CreatePolicy will create a Firewall Policy with a random name and given
79 // rule. An error will be returned if the rule could not be created.
80 func CreatePolicy(t *testing.T, client *gophercloud.ServiceClient, ruleID string) (*policies.Policy, error) {
81 policyName := tools.RandomString("TESTACC-", 8)
103 //source port, destination address and port. An error will be returned if
104 // the rule could not be created.
105 func CreateRule(t *testing.T, client *gophercloud.ServiceClient) (*rules.Rule, error) {
106 ruleName := tools.RandomString("TESTACC-", 8)
gotil_test.go (https://github.com/rexray/rexray.git) Go · 435 lines
layer3.go (https://github.com/gophercloud/gophercloud.git) Go · 387 lines
19 // CreateFloatingIP creates a floating IP on a given network and port. An error
20 // will be returned if the creation failed.
21 func CreateFloatingIP(t *testing.T, client *gophercloud.ServiceClient, networkID, portID string) (*floatingips.FloatingIP, error) {
22 t.Logf("Attempting to create floating IP on port: %s", portID)
43 // CreateFloatingIPWithFixedIP creates a floating IP on a given network and port with a
44 // defined fixed IP. An error will be returned if the creation failed.
45 func CreateFloatingIPWithFixedIP(t *testing.T, client *gophercloud.ServiceClient, networkID, portID, fixedIP string) (*floatingips.FloatingIP, error) {
46 t.Logf("Attempting to create floating IP on port: %s and address: %s", portID, fixedIP)
69 // CreatePortForwarding creates a port forwarding for a given floating IP
70 // and port. An error will be returned if the creation failed.
71 func CreatePortForwarding(t *testing.T, client *gophercloud.ServiceClient, fipID string, portID string, portFixedIPs []ports.IP) (*portforwarding.PortForwarding, error) {
72 t.Logf("Attempting to create Port forwarding for floating IP with ID: %s", fipID)
subnets_test.go (https://gitlab.com/unofficial-mirrors/openshift-origin) Go · 158 lines
13 )
15 func TestSubnetsList(t *testing.T) {
16 client, err := clients.NewNetworkV2Client()
17 if err != nil {
34 }
36 func TestSubnetCRUD(t *testing.T) {
37 client, err := clients.NewNetworkV2Client()
38 if err != nil {
58 // Update Subnet
59 newSubnetName := tools.RandomString("TESTACC-", 8)
60 updateOpts := subnets.UpdateOpts{
61 Name: newSubnetName,
containers_test.go (https://github.com/gophercloud/gophercloud.git) Go · 214 lines
13 )
15 func TestGenericContainersCRUD(t *testing.T) {
16 clients.SkipRelease(t, "stable/mitaka")
17 clients.SkipRelease(t, "stable/newton")
21 th.AssertNoErr(t, err)
23 payload := tools.RandomString("SUPERSECRET-", 8)
24 secret, err := CreateSecretWithPayload(t, client, payload)
25 th.AssertNoErr(t, err)
28 defer DeleteSecret(t, client, secretID)
30 payload1 := tools.RandomString("SUPERSECRET-", 8)
31 secret1, err := CreateSecretWithPayload(t, client, payload1)
32 th.AssertNoErr(t, err)
PatchConflictsUnitTestCase.java (https://github.com/robertpanzer/jboss-as.git) Java · 88 lines
26 import static org.jboss.as.patching.IoUtils.NO_CONTENT;
27 import static org.jboss.as.patching.runner.TestUtils.createModule0;
28 import static org.jboss.as.patching.runner.TestUtils.randomString;
29 import static org.jboss.as.patching.tool.PatchTool.Factory.policyBuilder;
65 // Create a conflict
66 final File base = builder.getFile("modules", "system", "layers", "base");
67 createModule0(base, "org.jboss.test", randomString());
69 final PatchingTestStepBuilder oneOff1 = builder.createStepBuilder();
AbstractTaskTestCase.java (https://github.com/robertpanzer/jboss-as.git) Java · 109 lines
28 import static org.jboss.as.patching.Constants.MODULES;
29 import static org.jboss.as.patching.IoUtils.mkdir;
30 import static org.jboss.as.patching.runner.TestUtils.randomString;
32 import java.io.File;
60 @Before
61 public void setup() throws Exception {
62 tempDir = mkdir(new File(System.getProperty("java.io.tmpdir")), "patching-" + randomString());
63 File jbossHome = mkdir(tempDir, "jboss-installation");
64 mkdir(jbossHome, MODULES, "system", LAYERS, BASE);
EditInlineTest.java (https://github.com/ntallapa/xwiki-enterprise.git) Java · 132 lines
20 package org.xwiki.test.ui;
22 import org.apache.commons.lang.RandomStringUtils;
23 import org.junit.Assert;
24 import org.junit.Test;
54 public void testInlineEditCanChangeTitle()
55 {
56 String title = RandomStringUtils.randomAlphanumeric(4);
57 getUtil().gotoPage("EditInlineTest", "testInlineEditCanChangeTitle", "inline", "title=" + title);
58 ViewPage vp = new InlinePage().clickSaveAndView();
73 public void testInlineEditPreservesTitle()
74 {
75 String title = RandomStringUtils.randomAlphanumeric(4);
76 getUtil().gotoPage("EditInlineTest", "testInlineEditPreservesTitle", "save", "title=" + title);
77 ViewPage vp = new ViewPage();
credentials_test.go (https://github.com/cozy/cozy-stack.git) Go · 236 lines
18 )
20 func TestEncryptDecrytCredentials(t *testing.T) {
21 encryptedCreds1, err := EncryptCredentials("me@mycozy.cloud", "fzEE6HFWsSp8jP")
22 if !assert.NoError(t, err) {
59 }
61 func TestEncryptDecrytUTF8Credentials(t *testing.T) {
62 rng := rand.New(rand.NewSource(time.Now().UnixNano()))
63 for i := 0; i < 1024; i++ {
81 for i := 0; i < 1024; i++ {
82 login := utils.RandomString(rng.Intn(256))
83 password := utils.RandomString(rng.Intn(256))
98 }
100 func TestDecryptCredentialsRandom(t *testing.T) {
101 rng := rand.New(rand.NewSource(time.Now().UnixNano()))
102 for i := 0; i < 1024; i++ {
blockstorage.go (https://gitlab.com/unofficial-mirrors/openshift-origin) Go · 142 lines
16 // CreateVolume will create a volume with a random name and size of 1GB. An
17 // error will be returned if the volume was unable to be created.
18 func CreateVolume(t *testing.T, client *gophercloud.ServiceClient) (*volumes.Volume, error) {
19 if testing.Short() {
20 t.Skip("Skipping test that requires volume creation in short mode.")
21 }
23 volumeName := tools.RandomString("ACPTTEST", 16)
24 t.Logf("Attempting to create volume: %s", volumeName)
44 // CreateVolumeFromImage will create a volume from with a random name and size of
45 // 1GB. An error will be returned if the volume was unable to be created.
46 func CreateVolumeFromImage(t *testing.T, client *gophercloud.ServiceClient) (*volumes.Volume, error) {
47 if testing.Short() {
48 t.Skip("Skipping test that requires volume creation in short mode.")
subscription_integration_test.go (https://gitlab.com/epicglue/api) Go · 164 lines
17 // Subscriptions
18 func TestSubscriptionsWithIncorrectInput(t *testing.T) {
19 client := http.Client{}
29 }
31 //func TestSubscriptions(t *testing.T) {
32 // client := http.Client{}
33 //
47 //
48 //// Subscribe
49 //func subscribeWithPayload(t *testing.T, payload map[string]interface{}) {
50 // client := http.Client{}
51 // req := test_helper.MakePutRequestWithUserId("/v1/subscription", payload, USER_ID)
stack_test.go (https://github.com/alibaba/terraform-provider.git) Go · 161 lines
resource_arm_dedicated_hardware_security_module_test.go (https://github.com/terraform-providers/terraform-provider-azurerm.git) Go · 287 lines
13 )
15 func TestAccAzureRMDedicatedHardwareSecurityModule_basic(t *testing.T) {
16 data := acceptance.BuildTestData(t, "azurerm_dedicated_hardware_security_module", "test")
32 }
34 func TestAccAzureRMDedicatedHardwareSecurityModule_requiresImport(t *testing.T) {
35 data := acceptance.BuildTestData(t, "azurerm_dedicated_hardware_security_module", "test")
51 }
53 func TestAccAzureRMDedicatedHardwareSecurityModule_complete(t *testing.T) {
54 data := acceptance.BuildTestData(t, "azurerm_dedicated_hardware_security_module", "test")
variable_integration_test.go (https://github.com/hashicorp/go-tfe.git) Go · 330 lines
12 )
14 func TestVariablesList(t *testing.T) {
15 client := testClient(t)
16 ctx := context.Background()
27 defer vTestCleanup2()
29 t.Run("without list options", func(t *testing.T) {
30 vl, err := client.Variables.List(ctx, wTest.ID, VariableListOptions{})
31 require.NoError(t, err)
38 })
40 t.Run("with list options", func(t *testing.T) {
41 t.Skip("paging not supported yet in API")
42 // Request a page number which is out of range. The result should
extensions.go (https://github.com/gophercloud/gophercloud.git) Go · 164 lines
16 // CreateExternalNetwork will create an external network. An error will be
17 // returned if the creation failed.
18 func CreateExternalNetwork(t *testing.T, client *gophercloud.ServiceClient) (*networks.Network, error) {
19 networkName := tools.RandomString("TESTACC-", 8)
20 networkDescription := tools.RandomString("TESTACC-DESC-", 8)
22 t.Logf("Attempting to create external network: %s", networkName)
51 // CreatePortWithSecurityGroup will create a port with a security group
52 // attached. An error will be returned if the port could not be created.
53 func CreatePortWithSecurityGroup(t *testing.T, client *gophercloud.ServiceClient, networkID, subnetID, secGroupID string) (*ports.Port, error) {
54 portName := tools.RandomString("TESTACC-", 8)
55 portDescription := tools.RandomString("TESTACC-DESC-", 8)
56 iFalse := false
dns.go (https://gitlab.com/unofficial-mirrors/openshift-origin) Go · 164 lines
12 // CreateRecordSet will create a RecordSet with a random name. An error will
13 // be returned if the zone was unable to be created.
14 func CreateRecordSet(t *testing.T, client *gophercloud.ServiceClient, zone *zones.Zone) (*recordsets.RecordSet, error) {
15 t.Logf("Attempting to create recordset: %s", zone.Name)
44 // CreateZone will create a Zone with a random name. An error will
45 // be returned if the zone was unable to be created.
46 func CreateZone(t *testing.T, client *gophercloud.ServiceClient) (*zones.Zone, error) {
47 zoneName := tools.RandomString("ACPTTEST", 8) + ".com."
78 //
79 // This is only for example purposes as it will try to do a zone transfer.
80 func CreateSecondaryZone(t *testing.T, client *gophercloud.ServiceClient) (*zones.Zone, error) {
81 zoneName := tools.RandomString("ACPTTEST", 8) + ".com."
109 // the record set failed to be deleted. This works best when used as a deferred
110 // function.
111 func DeleteRecordSet(t *testing.T, client *gophercloud.ServiceClient, rs *recordsets.RecordSet) {
112 err := recordsets.Delete(client, rs.ZoneID, rs.ID).ExtractErr()
113 if err != nil {
operator_test.go (https://github.com/arangodb/kube-arangodb.git) Go · 371 lines
43 )
45 func Test_Operator_InformerProcessing(t *testing.T) {
46 // Arrange
47 name := string(uuid.NewUUID())
51 objects := make([]string, size)
52 for id := range objects {
53 objects[id] = randomString(10)
54 }
92 }
94 func Test_Operator_MultipleInformers(t *testing.T) {
95 // Arrange
96 name := string(uuid.NewUUID())
pipeline_test.go (https://github.com/ovh/cds.git) Go · 309 lines
data.go (https://github.com/terraform-providers/terraform-provider-azurerm.git) Go · 127 lines
30 RandomInteger int
32 // RandomString is a random 5 character string is unique to this test case
33 RandomString string
57 // BuildTestData generates some test data for the given resource
58 func BuildTestData(t *testing.T, resourceType string, resourceLabel string) TestData {
59 EnsureProvidersAreInitialised()
66 testData := TestData{
67 RandomInteger: tf.AccRandTimeInt(),
68 RandomString: acctest.RandString(5),
69 ResourceName: fmt.Sprintf("%s.%s", resourceType, resourceLabel),
70 Environment: *env,
117 }
119 // RandomStringOfLength is a random 1 to 1024 character string which is unique to this test case
120 func (td *TestData) RandomStringOfLength(len int) string {
mpt_test.go (https://github.com/33cn/plugin.git) Go · 321 lines
25 }
27 func TestKvdbNewClose(t *testing.T) {
28 dir, err := ioutil.TempDir("", "example")
29 assert.Nil(t, err)
37 }
39 func TestKvddbSetGet(t *testing.T) {
40 dir, err := ioutil.TempDir("", "example")
41 assert.Nil(t, err)
84 }
86 func TestKvdbMemSet(t *testing.T) {
87 dir, err := ioutil.TempDir("", "example")
88 assert.Nil(t, err)
routers_test.go (https://gitlab.com/unofficial-mirrors/openshift-origin) Go · 119 lines
13 )
15 func TestLayer3RouterList(t *testing.T) {
16 client, err := clients.NewNetworkV2Client()
17 if err != nil {
35 }
37 func TestLayer3ExternalRouterCreateDelete(t *testing.T) {
38 client, err := clients.NewNetworkV2Client()
39 if err != nil {
49 tools.PrintResource(t, router)
51 newName := tools.RandomString("TESTACC-", 8)
52 updateOpts := routers.UpdateOpts{
53 Name: newName,
store_test.go (https://github.com/gruntwork-io/terratest.git) Go · 190 lines
resource_arm_backup_container_storage_account_test.go (https://github.com/terraform-providers/terraform-provider-azurerm.git) Go · 147 lines
13 )
15 func TestAccAzureRMBackupProtectionContainerStorageAccount_basic(t *testing.T) {
16 data := acceptance.BuildTestData(t, "azurerm_backup_container_storage_account", "test")
66 storage_account_id = azurerm_storage_account.test.id
67 }
68 `, data.RandomInteger, data.Locations.Primary, data.RandomInteger, data.RandomString)
69 }
user_integration_test.go (https://gitlab.com/epicglue/api) Go · 124 lines
resource_arm_storage_table_entity_test.go (https://github.com/terraform-providers/terraform-provider-azurerm.git) Go · 254 lines
13 )
15 func TestAccAzureRMTableEntity_basic(t *testing.T) {
16 data := acceptance.BuildTestData(t, "azurerm_storage_table_entity", "test")
32 }
34 func TestAccAzureRMTableEntity_requiresImport(t *testing.T) {
35 data := acceptance.BuildTestData(t, "azurerm_storage_table_entity", "test")
54 }
56 func TestAccAzureRMTableEntity_update(t *testing.T) {
57 data := acceptance.BuildTestData(t, "azurerm_storage_table_entity", "test")
ports_test.go (https://gitlab.com/unofficial-mirrors/openshift-origin) Go · 349 lines
12 )
14 func TestPortsList(t *testing.T) {
15 client, err := clients.NewNetworkV2Client()
16 if err != nil {
33 }
35 func TestPortsCRUD(t *testing.T) {
36 client, err := clients.NewNetworkV2Client()
37 if err != nil {
68 // Update port
69 newPortName := tools.RandomString("TESTACC-", 8)
70 updateOpts := ports.UpdateOpts{
71 Name: newPortName,
database_autonomous_database_instance_wallet_management_test.go (https://github.com/oracle/terraform-provider-oci.git) Go · 106 lines
17 var (
18 adbWalletMgmtDbName = RandomString(1, charsetWithoutDigits) + RandomString(13, charset)
20 AutonomousDatabaseInstanceWalletManagementResourceConfig = AutonomousDatabaseInstanceWalletManagementResourceDependencies +
36 // issue-routing-tag: database/dbaas-adb
37 func TestDatabaseAutonomousDatabaseInstanceWalletManagementResource_basic(t *testing.T) {
38 httpreplay.SetScenario("TestDatabaseAutonomousDatabaseInstanceWalletManagementResource_basic")
39 defer httpreplay.SaveScenario()
resource_arm_storage_table_test.go (https://github.com/terraform-providers/terraform-provider-azurerm.git) Go · 382 lines
15 )
17 func TestAccAzureRMStorageTable_basic(t *testing.T) {
18 data := acceptance.BuildTestData(t, "azurerm_storage_table", "test")
34 }
36 func TestAccAzureRMStorageTable_requiresImport(t *testing.T) {
37 data := acceptance.BuildTestData(t, "azurerm_storage_table", "test")
56 }
58 func TestAccAzureRMStorageTable_disappears(t *testing.T) {
59 data := acceptance.BuildTestData(t, "azurerm_storage_table", "test")
objects_test.go (https://gitlab.com/unofficial-mirrors/openshift-origin) Go · 257 lines
18 var numObjects = 2
20 func TestObjects(t *testing.T) {
21 client, err := clients.NewObjectStorageV1Client()
22 if err != nil {
27 oNames := make([]string, numObjects)
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()
35 th.AssertNoErr(t, err)
dependencies_test.go (https://github.com/deislabs/porter.git) Go · 221 lines
16 )
18 func TestDependenciesLifecycle(t *testing.T) {
19 p := porter.NewTestPorter(t)
20 p.SetupIntegrationTest()
32 }
34 func randomString(len int) string {
35 rand.Seed(time.Now().UnixNano())
36 bytes := make([]byte, len)
63 p.CopyDirectory(filepath.Join(p.TestDir, "../build/testdata/bundles/wordpress"), ".", false)
65 namespace = randomString(10)
66 installOpts := porter.InstallOptions{}
67 installOpts.CredentialIdentifiers = []string{"ci"}
messaging.go (https://github.com/gophercloud/gophercloud.git) Go · 173 lines
13 )
15 func CreateQueue(t *testing.T, client *gophercloud.ServiceClient) (string, error) {
16 queueName := tools.RandomString("ACPTTEST", 5)
39 }
41 func DeleteQueue(t *testing.T, client *gophercloud.ServiceClient, queueName string) {
42 t.Logf("Attempting to delete Queue: %s", queueName)
43 err := queues.Delete(client, queueName).ExtractErr()
49 }
51 func GetQueue(t *testing.T, client *gophercloud.ServiceClient, queueName string) (queues.QueueDetails, error) {
52 t.Logf("Attempting to get Queue: %s", queueName)
53 queue, err := queues.Get(client, queueName).Extract()
58 }
60 func CreateShare(t *testing.T, client *gophercloud.ServiceClient, queueName string) (queues.QueueShare, error) {
61 t.Logf("Attempting to create share for queue: %s", queueName)
serviceclass_converter_test.go (https://github.com/kyma-project/kyma.git) Go · 205 lines
15 )
17 func TestServiceClassConverter_ToGQL(t *testing.T) {
18 var mockTimeStamp metav1.Time
19 var zeroTimeStamp time.Time
20 t.Run("All properties are given", func(t *testing.T) {
21 converter := serviceClassConverter{}
83 })
85 t.Run("Invalid externalMetadata (not equals to maps[string]string)", func(t *testing.T) {
86 converter := serviceClassConverter{}
87 maps := "randomString"