text
stringlengths
93
16.4k
id
stringlengths
20
40
metadata
dict
input_ids
listlengths
45
2.05k
attention_mask
listlengths
45
2.05k
complexity
int64
1
9
func TestGetOrderbook(t *testing.T) { t.Parallel() _, err := f.GetOrderbook(context.Background(), spotPair, 5) if err != nil { t.Error(err) } }
explode_data.jsonl/15157
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 63 }
[ 2830, 3393, 1949, 4431, 2190, 1155, 353, 8840, 836, 8, 341, 3244, 41288, 7957, 741, 197, 6878, 1848, 1669, 282, 2234, 4431, 2190, 5378, 19047, 1507, 7702, 12443, 11, 220, 20, 340, 743, 1848, 961, 2092, 341, 197, 3244, 6141, 3964, 340,...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1 ]
2
func TestTimeoutPendingWrite(t *testing.T) { l, err := ListenPipe(testPipeName, nil) if err != nil { t.Fatal(err) } defer l.Close() serverDone := make(chan struct{}) isReading := make(chan struct{}) wrote := make(chan struct{}) go func() { s, err := l.Accept() if err != nil { t.Fatal(err) } isReading <- struct{}{} s.Close() close(serverDone) }() client, err := DialPipe(testPipeName, nil) if err != nil { t.Fatal(err) } defer client.Close() clientErr := make(chan error) go func() { <-isReading // allow it to close _, err = client.Write([]byte("this should timeout")) wrote <- struct{}{} clientErr <- err }() client.SetWriteDeadline(aLongTimeAgo) <-wrote select { case err = <-clientErr: if err != ErrTimeout { t.Fatalf("expected ErrTimeout, got %v", err) } case <-time.After(100 * time.Millisecond): t.Fatalf("timed out while waiting for write to cancel") <-clientErr } <-serverDone }
explode_data.jsonl/11432
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 392 }
[ 2830, 3393, 7636, 32027, 7985, 1155, 353, 8840, 836, 8, 341, 8810, 11, 1848, 1669, 32149, 34077, 8623, 34077, 675, 11, 2092, 340, 743, 1848, 961, 2092, 341, 197, 3244, 26133, 3964, 340, 197, 532, 16867, 326, 10421, 2822, 41057, 17453, ...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
2
func TestMSSNotDelayed(t *testing.T) { tests := []struct { name string fn func(tcpip.Endpoint) }{ {"no-op", func(tcpip.Endpoint) {}}, {"delay", func(ep tcpip.Endpoint) { ep.SetSockOpt(tcpip.DelayOption(1)) }}, {"cork", func(ep tcpip.Endpoint) { ep.SetSockOpt(tcpip.CorkOption(1)) }}, } for _, test := range tests { t.Run(test.name, func(t *testing.T) { const maxPayload = 100 c := context.New(t, defaultMTU) defer c.Cleanup() c.CreateConnectedWithRawOptions(789, 30000, nil, []byte{ header.TCPOptionMSS, 4, byte(maxPayload / 256), byte(maxPayload % 256), }) test.fn(c.EP) allData := [][]byte{{0}, make([]byte, maxPayload), make([]byte, maxPayload)} for i, data := range allData { view := buffer.NewViewFromBytes(data) if _, _, err := c.EP.Write(tcpip.SlicePayload(view), tcpip.WriteOptions{}); err != nil { t.Fatalf("Write #%d failed: %v", i+1, err) } } seq := c.IRS.Add(1) for i, data := range allData { // Check that data is received. packet := c.GetPacket() checker.IPv4(t, packet, checker.PayloadLen(len(data)+header.TCPMinimumSize), checker.TCP( checker.DstPort(context.TestPort), checker.SeqNum(uint32(seq)), checker.AckNum(790), checker.TCPFlagsMatch(header.TCPFlagAck, ^uint8(header.TCPFlagPsh)), ), ) if got, want := packet[header.IPv4MinimumSize+header.TCPMinimumSize:], data; !bytes.Equal(got, want) { t.Fatalf("got packet #%d's data = %v, want = %v", i+1, got, want) } seq = seq.Add(seqnum.Size(len(data))) } // Acknowledge the data. c.SendPacket(nil, &context.Headers{ SrcPort: context.TestPort, DstPort: c.Port, Flags: header.TCPFlagAck, SeqNum: 790, AckNum: seq, RcvWnd: 30000, }) }) } }
explode_data.jsonl/22299
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 857 }
[ 2830, 3393, 44, 1220, 2623, 57361, 1155, 353, 8840, 836, 8, 341, 78216, 1669, 3056, 1235, 341, 197, 11609, 914, 198, 197, 40095, 256, 2915, 98203, 573, 90409, 340, 197, 59403, 197, 197, 4913, 2152, 29492, 497, 2915, 98203, 573, 90409, ...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
1
func TestBasicMarshal(t *testing.T) { result, err := Marshal(basicTestData) if err != nil { t.Fatal(err) } expected := basicTestToml if !bytes.Equal(result, expected) { t.Errorf("Bad marshal: expected\n-----\n%s\n-----\ngot\n-----\n%s\n-----\n", expected, result) } }
explode_data.jsonl/46301
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 115 }
[ 2830, 3393, 15944, 55438, 1155, 353, 8840, 836, 8, 341, 9559, 11, 1848, 1669, 35667, 1883, 5971, 83920, 340, 743, 1848, 961, 2092, 341, 197, 3244, 26133, 3964, 340, 197, 532, 42400, 1669, 6770, 2271, 24732, 75, 198, 743, 753, 9651, 12...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
3
func TestCreateCustomEndpointConfigRemainingFunctions(t *testing.T) { // test other sub interface functions endpointConfigOption, err := BuildConfigEndpointFromOptions(m11, m12, m13, m14, m15, m16) if err != nil { t.Fatalf("BuildConfigEndpointFromOptions returned unexpected error %s", err) } var eco *EndpointConfigOptions var ok bool if eco, ok = endpointConfigOption.(*EndpointConfigOptions); !ok { t.Fatalf("BuildConfigEndpointFromOptions did not return a Options instance %T", endpointConfigOption) } if eco == nil { t.Fatal("build ConfigEndpointOption returned is nil") } // verify that their functions are available p, ok := eco.ChannelPeers("") if !ok { t.Fatal("ChannelPeers expected to succeed") } if len(p) != 1 { t.Fatalf("ChannelPeers did not return expected interface value. Expected: 1 ChannelPeer, Received: %d", len(p)) } c := eco.TLSClientCerts() if len(c) != 2 { t.Fatalf("TLSClientCerts did not return expected interface value. Expected: 2 Certificates, Received: %d", len(c)) } // verify if an interface that was not passed as an option but was not nil, it should be nil if eco.timeout != nil { t.Fatalf("timeout created with nil timeout interface but got non nil one. %s", eco.timeout) } // now try with non related interface to test if an error returns var badType interface{} _, err = BuildConfigEndpointFromOptions(m12, m13, badType) if err == nil { t.Fatal("BuildConfigEndpointFromOptions did not return error with badType") } }
explode_data.jsonl/29411
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 481 }
[ 2830, 3393, 4021, 10268, 27380, 2648, 54745, 25207, 1155, 353, 8840, 836, 8, 341, 197, 322, 1273, 1008, 1186, 3749, 5746, 198, 6246, 2768, 2648, 5341, 11, 1848, 1669, 7854, 2648, 27380, 3830, 3798, 1255, 16, 16, 11, 296, 16, 17, 11, ...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
9
func TestDynamicMetadata(t *testing.T) { tests := []struct { desc string authContext map[string]interface{} apiMetadata map[string]interface{} opMetadata map[string]interface{} want map[string]interface{} }{ { desc: "no dynamic metadata", authContext: map[string]interface{}{ "auth": "value", }, apiMetadata: nil, opMetadata: nil, want: map[string]interface{}{ "auth": "value", }, }, { desc: "op override api", authContext: map[string]interface{}{ "auth": "value", }, apiMetadata: map[string]interface{}{ "api": "value", }, opMetadata: map[string]interface{}{ "op": "value", }, want: map[string]interface{}{ "auth": "value", "op": "value", }, }, { desc: "empty op override api", authContext: map[string]interface{}{ "auth": "value", }, apiMetadata: map[string]interface{}{ "api": "value", }, opMetadata: map[string]interface{}{}, want: map[string]interface{}{ "auth": "value", }, }, { desc: "api overwrite auth", authContext: map[string]interface{}{ "auth": "value", "auth2": "value", }, apiMetadata: map[string]interface{}{ "auth": "override", "api": "value", }, opMetadata: nil, want: map[string]interface{}{ "auth": "override", "auth2": "value", "api": "value", }, }, { desc: "op overwrite auth", authContext: map[string]interface{}{ "auth": "value", "auth2": "value", }, apiMetadata: map[string]interface{}{}, opMetadata: map[string]interface{}{ "auth": "override", "op": "value", }, want: map[string]interface{}{ "auth": "override", "auth2": "value", "op": "value", }, }, } for _, test := range tests { t.Run(test.desc, func(t *testing.T) { envSpec := createAuthEnvSpec() envSpec.APIs[0].DynamicMetadata = test.apiMetadata envSpec.APIs[0].Operations[0].DynamicMetadata = test.opMetadata specExt, err := config.NewEnvironmentSpecExt(&envSpec) if err != nil { t.Fatal(err) } envoyReq := testutil.NewEnvoyRequest("GET", "/v1/petstore", nil, nil) specReq := config.NewEnvironmentSpecRequest(nil, specExt, envoyReq) got, err := structpb.NewStruct(test.authContext) if err != nil { t.Fatal(err) } err = addDynamicMetadata(got, specReq) if err != nil { t.Fatal(err) } if diff := cmp.Diff(test.want, got.AsMap()); diff != "" { t.Errorf("query diff (-want +got):\n%s", diff) } }) } }
explode_data.jsonl/73189
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 1165 }
[ 2830, 3393, 21752, 14610, 1155, 353, 8840, 836, 8, 341, 78216, 1669, 3056, 1235, 341, 197, 41653, 286, 914, 198, 197, 78011, 1972, 2415, 14032, 31344, 16094, 197, 54299, 14610, 2415, 14032, 31344, 16094, 197, 39703, 14610, 220, 2415, 1403...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
5
func TestValidateClientAuthorization(t *testing.T) { errs := ValidateClientAuthorization(&oapi.OAuthClientAuthorization{ ObjectMeta: metav1.ObjectMeta{Name: "myusername:myclientname"}, ClientName: "myclientname", UserName: "myusername", UserUID: "myuseruid", }) if len(errs) != 0 { t.Errorf("expected success: %v", errs) } errorCases := map[string]struct { A oapi.OAuthClientAuthorization T field.ErrorType F string }{ "zero-length name": { A: oapi.OAuthClientAuthorization{ ClientName: "myclientname", UserName: "myusername", UserUID: "myuseruid", }, T: field.ErrorTypeRequired, F: "metadata.name", }, "invalid name": { A: oapi.OAuthClientAuthorization{ ObjectMeta: metav1.ObjectMeta{Name: "anotheruser:anotherclient"}, ClientName: "myclientname", UserName: "myusername", UserUID: "myuseruid", }, T: field.ErrorTypeInvalid, F: "metadata.name", }, "disallowed namespace": { A: oapi.OAuthClientAuthorization{ ObjectMeta: metav1.ObjectMeta{Name: "myusername:myclientname", Namespace: "foo"}, ClientName: "myclientname", UserName: "myusername", UserUID: "myuseruid", }, T: field.ErrorTypeForbidden, F: "metadata.namespace", }, "no scope handler": { A: oapi.OAuthClientAuthorization{ ObjectMeta: metav1.ObjectMeta{Name: "myusername:myclientname"}, ClientName: "myclientname", UserName: "myusername", UserUID: "myuseruid", Scopes: []string{"invalid"}, }, T: field.ErrorTypeInvalid, F: "scopes[0]", }, "bad scope": { A: oapi.OAuthClientAuthorization{ ObjectMeta: metav1.ObjectMeta{Name: "myusername:myclientname"}, ClientName: "myclientname", UserName: "myusername", UserUID: "myuseruid", Scopes: []string{"user:dne"}, }, T: field.ErrorTypeInvalid, F: "scopes[0]", }, } for k, v := range errorCases { errs := ValidateClientAuthorization(&v.A) if len(errs) == 0 { t.Errorf("expected failure %s for %v", k, v.A) continue } for i := range errs { if errs[i].Type != v.T { t.Errorf("%s: expected errors to have type %s GOT: %v", k, v.T, errs[i]) } if errs[i].Field != v.F { t.Errorf("%s: expected errors to have field %s GOT: %v", k, v.F, errs[i]) } } } }
explode_data.jsonl/78247
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 1023 }
[ 2830, 3393, 17926, 2959, 18124, 1155, 353, 8840, 836, 8, 341, 9859, 82, 1669, 23282, 2959, 18124, 2099, 78, 2068, 8382, 5087, 2959, 18124, 515, 197, 23816, 12175, 25, 77520, 16, 80222, 63121, 25, 330, 2408, 5113, 25, 2408, 2972, 606, ...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
7
func TestStopPreviousDigest_PreviouDigestIsRunning(t *testing.T) { containerStopped := []string{} getRunningContainerIds = func(_ *dockerClient.Client, _ string, _ string) []string { return []string{"a", "c"} } stopContainer = func(_ *Cake, id string) { containerStopped = append(containerStopped, id) } cake := Cake{ PreviousDigest: "TestPreviousDigest", ContainersRunning: map[string]int{ "a": 0, "b": 0, "c": 0, "d": 0, }, } expected := map[string]int{ "b": 0, "d": 0, } cake.StopPreviousDigest() for id := range expected { if _, ok := cake.ContainersRunning[id]; ok != true { t.Logf("Expected %s to be running, but instead was stopped", id) t.Fail() } } if len(containerStopped) != 2 { log(t, containerStopped, []string{"a", "c"}) t.Fail() } }
explode_data.jsonl/49464
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 329 }
[ 2830, 3393, 10674, 21291, 45217, 1088, 7282, 98255, 45217, 3872, 18990, 1155, 353, 8840, 836, 8, 341, 53290, 59803, 1669, 3056, 917, 31483, 10366, 18990, 4502, 12701, 284, 2915, 2490, 353, 28648, 2959, 11716, 11, 716, 914, 11, 716, 914, ...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
1
func TestRoles(t *testing.T) { t.Parallel() Convey("Works", t, func() { fakeDB := authtest.FakeDB{ "user:admin@example.com": {"admins"}, "user:top-owner@example.com": {"top-owners"}, "user:top-writer@example.com": {"top-writers"}, "user:top-reader@example.com": {"top-readers"}, "user:inner-owner@example.com": {"inner-owners"}, "user:inner-writer@example.com": {"inner-writers"}, "user:inner-reader@example.com": {"inner-readers"}, } metas := []*api.PrefixMetadata{} metas = addPrefixACLs(metas, "", map[api.Role][]string{ api.Role_OWNER: {"group:admins"}, }) metas = addPrefixACLs(metas, "top", map[api.Role][]string{ api.Role_OWNER: {"user:direct-owner@example.com", "group:top-owners"}, api.Role_WRITER: {"group:top-writers"}, api.Role_READER: {"group:top-readers"}, }) metas = addPrefixACLs(metas, "top/something/else", map[api.Role][]string{ api.Role_OWNER: {"group:inner-owners"}, api.Role_WRITER: {"group:inner-writers"}, api.Role_READER: {"group:inner-readers"}, }) allRoles := []api.Role{api.Role_READER, api.Role_WRITER, api.Role_OWNER} writerRoles := []api.Role{api.Role_READER, api.Role_WRITER} readerRoles := []api.Role{api.Role_READER} noRoles := []api.Role{} expectedRoles := []struct { user identity.Identity expectedRoles []api.Role }{ {"user:admin@example.com", allRoles}, {"user:direct-owner@example.com", allRoles}, {"user:top-owner@example.com", allRoles}, {"user:inner-owner@example.com", allRoles}, {"user:top-writer@example.com", writerRoles}, {"user:inner-writer@example.com", writerRoles}, {"user:top-reader@example.com", readerRoles}, {"user:inner-reader@example.com", readerRoles}, {"user:someone-else@example.com", noRoles}, {"anonymous:anonymous", noRoles}, } for _, tc := range expectedRoles { Convey(fmt.Sprintf("User %s roles", tc.user), func() { ctx := auth.WithState(context.Background(), &authtest.FakeState{ Identity: tc.user, FakeDB: fakeDB, }) // Get the roles by checking explicitly each one via hasRole. Convey("hasRole works", func() { haveRoles := []api.Role{} for _, r := range allRoles { yes, err := hasRole(ctx, metas, r) So(err, ShouldBeNil) if yes { haveRoles = append(haveRoles, r) } } So(haveRoles, ShouldResemble, tc.expectedRoles) }) // Get the same set of roles through rolesInPrefix. Convey("rolesInPrefix", func() { haveRoles, err := rolesInPrefix(ctx, metas) So(err, ShouldBeNil) So(haveRoles, ShouldResemble, tc.expectedRoles) }) }) } }) }
explode_data.jsonl/69453
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 1154 }
[ 2830, 3393, 25116, 1155, 353, 8840, 836, 8, 341, 3244, 41288, 7957, 2822, 93070, 5617, 445, 37683, 497, 259, 11, 2915, 368, 341, 197, 1166, 726, 3506, 1669, 3078, 426, 477, 991, 726, 3506, 515, 298, 197, 76522, 25, 2882, 35487, 905, ...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
3
func TestIsBeingReplaced(t *testing.T) { namespace := "ns" type initial struct { csvs map[string]*v1alpha1.ClusterServiceVersion } tests := []struct { name string initial initial in *v1alpha1.ClusterServiceVersion expected *v1alpha1.ClusterServiceVersion }{ { name: "QueryErr", in: csv("name", namespace, "0.0.0", "", installStrategy("dep", nil, nil), nil, nil, v1alpha1.CSVPhaseSucceeded), expected: nil, }, { name: "CSVInCluster/NotReplacing", in: csv("csv1", namespace, "0.0.0", "", installStrategy("dep", nil, nil), nil, nil, v1alpha1.CSVPhaseSucceeded), initial: initial{ csvs: map[string]*v1alpha1.ClusterServiceVersion{ "csv2": csv("csv2", namespace, "0.0.0", "", installStrategy("dep", nil, nil), nil, nil, v1alpha1.CSVPhaseSucceeded), }, }, expected: nil, }, { name: "CSVInCluster/Replacing", in: csv("csv1", namespace, "0.0.0", "", installStrategy("dep", nil, nil), nil, nil, v1alpha1.CSVPhaseSucceeded), initial: initial{ csvs: map[string]*v1alpha1.ClusterServiceVersion{ "csv2": csv("csv2", namespace, "0.0.0", "csv1", installStrategy("dep", nil, nil), nil, nil, v1alpha1.CSVPhaseSucceeded), }, }, expected: csv("csv2", namespace, "0.0.0", "csv1", installStrategy("dep", nil, nil), nil, nil, v1alpha1.CSVPhaseSucceeded), }, } for _, tt := range tests { t.Run(tt.name, func(t *testing.T) { ctx, cancel := context.WithCancel(context.TODO()) defer cancel() op, err := NewFakeOperator(ctx, withNamespaces(namespace)) require.NoError(t, err) require.Equal(t, tt.expected, op.isBeingReplaced(tt.in, tt.initial.csvs)) }) } }
explode_data.jsonl/31214
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 743 }
[ 2830, 3393, 3872, 33142, 693, 36369, 1155, 353, 8840, 836, 8, 341, 56623, 1669, 330, 4412, 1837, 13158, 2856, 2036, 341, 197, 1444, 3492, 82, 2415, 14032, 8465, 85, 16, 7141, 16, 72883, 1860, 5637, 198, 197, 532, 78216, 1669, 3056, 12...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
1
func TestLiveUpdateCustomBuildLocalContainer(t *testing.T) { f := newBDFixture(t, k8s.EnvDockerDesktop, container.RuntimeDocker) defer f.TearDown() lu := assembleLiveUpdate(SanchoSyncSteps(f), SanchoRunSteps, true, []string{"i/match/nothing"}, f) tCase := testCase{ manifest: manifestbuilder.New(f, "sancho"). WithK8sYAML(SanchoYAML). WithImageTarget(NewSanchoCustomBuildImageTarget(f)). WithLiveUpdate(lu). Build(), changedFiles: []string{"app/a.txt"}, expectDockerBuildCount: 0, expectDockerPushCount: 0, expectDockerCopyCount: 1, expectDockerExecCount: 1, expectDockerRestartCount: 1, } runTestCase(t, f, tCase) }
explode_data.jsonl/35167
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 286 }
[ 2830, 3393, 20324, 4289, 10268, 11066, 7319, 4502, 1155, 353, 8840, 836, 8, 341, 1166, 1669, 501, 33, 5262, 12735, 1155, 11, 595, 23, 82, 81214, 35, 13659, 23597, 11, 5476, 16706, 35, 13659, 340, 16867, 282, 836, 682, 4454, 2822, 8810...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
1
func TestNoopCondition(t *testing.T) { source := sourceImage(t) result, err := mutate.AppendLayers(source, []v1.Layer{}...) if err != nil { t.Fatalf("Unexpected error creating a writable image: %v", err) } if !manifestsAreEqual(t, source, result) { t.Error("manifests are not the same") } if !configFilesAreEqual(t, source, result) { t.Fatal("config files are not the same") } }
explode_data.jsonl/3090
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 151 }
[ 2830, 3393, 2753, 453, 10547, 1155, 353, 8840, 836, 8, 341, 47418, 1669, 2530, 1906, 1155, 692, 9559, 11, 1848, 1669, 67182, 8982, 40235, 12437, 11, 3056, 85, 16, 66074, 6257, 31218, 743, 1848, 961, 2092, 341, 197, 3244, 30762, 445, 2...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
4
func TestMapSerialization(t *testing.T) { m := New[string, float32]() m.Put("a", 1.0) m.Put("b", 2.0) m.Put("c", 3.0) var err error assert := func() { if actualValue, expectedValue := m.Keys(), []string{"a", "b", "c"}; !sameElements(actualValue, expectedValue) { t.Errorf("Got %v expected %v", actualValue, expectedValue) } if actualValue, expectedValue := m.Values(), []float32{1.0, 2.0, 3.0}; !sameElements(actualValue, expectedValue) { t.Errorf("Got %v expected %v", actualValue, expectedValue) } if actualValue, expectedValue := m.Size(), 3; actualValue != expectedValue { t.Errorf("Got %v expected %v", actualValue, expectedValue) } if err != nil { t.Errorf("Got error %v", err) } } assert() json, err := m.ToJSON() assert() err = m.FromJSON(json) assert() }
explode_data.jsonl/13508
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 320 }
[ 2830, 3393, 2227, 35865, 1155, 353, 8840, 836, 8, 341, 2109, 1669, 1532, 14032, 11, 2224, 18, 17, 36622, 2109, 39825, 445, 64, 497, 220, 16, 13, 15, 340, 2109, 39825, 445, 65, 497, 220, 17, 13, 15, 340, 2109, 39825, 445, 66, 497, ...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
5
func TestConvertState(t *testing.T) { tests := []struct { src string dst scm.State }{ { src: "failure", dst: scm.StateFailure, }, { src: "error", dst: scm.StateError, }, { src: "pending", dst: scm.StatePending, }, { src: "success", dst: scm.StateSuccess, }, { src: "invalid", dst: scm.StateUnknown, }, } for _, test := range tests { if got, want := convertState(test.src), test.dst; got != want { t.Errorf("Want state %s converted to %v", test.src, test.dst) } } }
explode_data.jsonl/29877
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 264 }
[ 2830, 3393, 12012, 1397, 1155, 353, 8840, 836, 8, 341, 78216, 1669, 3056, 1235, 341, 197, 41144, 914, 198, 197, 52051, 85520, 18942, 198, 197, 59403, 197, 197, 515, 298, 41144, 25, 330, 28939, 756, 298, 52051, 25, 85520, 18942, 17507, ...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
3
func Test_OutStdoutStderr(t *testing.T) { expected := foo var bufStdout bytes.Buffer var bufStderr bytes.Buffer err := cmder.New("bash", "-c", fmt.Sprintf("printf %s | tee /dev/stderr", foo)). Out(&bufStdout, &bufStderr). Run() if err != nil { t.Error(err) } stdout := bufStdout.String() stderr := bufStderr.String() msg := fmt.Sprintf("Expected stdout to be '%s' Got '%s'", expected, stdout) assert.Equal(t, expected, stdout, msg) msg = fmt.Sprintf("Expected stderr to be '%s' Got '%s'", expected, stderr) assert.Equal(t, expected, stderr, msg) }
explode_data.jsonl/70666
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 238 }
[ 2830, 3393, 36675, 22748, 411, 22748, 615, 1155, 353, 8840, 836, 8, 341, 42400, 1669, 15229, 271, 2405, 6607, 22748, 411, 5820, 22622, 271, 2405, 6607, 22748, 615, 5820, 22622, 271, 9859, 1669, 9961, 1107, 7121, 445, 46216, 497, 6523, 6...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
2
func TestDoesNotDeletePodDirsForTerminatedPods(t *testing.T) { testKubelet := newTestKubelet(t) testKubelet.fakeCadvisor.On("MachineInfo").Return(&cadvisorapi.MachineInfo{}, nil) testKubelet.fakeCadvisor.On("DockerImagesFsInfo").Return(cadvisorapiv2.FsInfo{}, nil) testKubelet.fakeCadvisor.On("RootFsInfo").Return(cadvisorapiv2.FsInfo{}, nil) kl := testKubelet.kubelet pods := []*api.Pod{ { ObjectMeta: api.ObjectMeta{ UID: "12345678", Name: "pod1", Namespace: "ns", }, }, { ObjectMeta: api.ObjectMeta{ UID: "12345679", Name: "pod2", Namespace: "ns", }, }, { ObjectMeta: api.ObjectMeta{ UID: "12345680", Name: "pod3", Namespace: "ns", }, }, } syncAndVerifyPodDir(t, testKubelet, pods, pods, true) // Pod 1 failed, and pod 2 succeeded. None of the pod directories should be // deleted. kl.statusManager.SetPodStatus(pods[1], api.PodStatus{Phase: api.PodFailed}) kl.statusManager.SetPodStatus(pods[2], api.PodStatus{Phase: api.PodSucceeded}) syncAndVerifyPodDir(t, testKubelet, pods, pods, true) }
explode_data.jsonl/43352
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 500 }
[ 2830, 3393, 21468, 2623, 6435, 23527, 97384, 2461, 21209, 51199, 23527, 82, 1155, 353, 8840, 836, 8, 341, 18185, 42, 3760, 1149, 1669, 501, 2271, 42, 3760, 1149, 1155, 340, 18185, 42, 3760, 1149, 94624, 34, 81794, 8071, 445, 21605, 1731...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
1
func TestUnmarshalMap(t *testing.T) { var m1 = Parse(exampleJSON).Value().(map[string]interface{}) var m2 map[string]interface{} if err := json.Unmarshal([]byte(exampleJSON), &m2); err != nil { t.Fatal(err) } b1, err := json.Marshal(m1) if err != nil { t.Fatal(err) } b2, err := json.Marshal(m2) if err != nil { t.Fatal(err) } if !bytes.Equal(b1, b2) { t.Fatal("b1 != b2") } }
explode_data.jsonl/43437
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 193 }
[ 2830, 3393, 1806, 27121, 2227, 1155, 353, 8840, 836, 8, 341, 2405, 296, 16, 284, 14775, 66203, 5370, 568, 1130, 1005, 7, 2186, 14032, 31344, 37790, 2405, 296, 17, 2415, 14032, 31344, 16094, 743, 1848, 1669, 2951, 38097, 10556, 3782, 662...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
5
func TestMultiBot_OnMessage(t *testing.T) { mockBot := MockBot{} bot := MultiBot{ &mockBot, } mockBot.On("OnMessage", mock.MatchedBy(func(msg Message) bool { return msg.Text == "blah" })).Return(&Response{ BanInterval: 999, }) assert.Nil(t, bot.OnMessage(Message{ Text: "blah", })) mockBot.On("OnMessage", mock.Anything).Return(&Response{ Text: "foo", Pin: true, Unpin: true, Preview: true, Reply: true, BanInterval: 999, }) assert.Equal(t, &Response{ Text: "foo", Pin: true, Unpin: true, Preview: true, Reply: true, BanInterval: 999, }, bot.OnMessage(Message{ Text: "blahblah", })) }
explode_data.jsonl/15510
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 343 }
[ 2830, 3393, 20358, 23502, 35482, 2052, 1155, 353, 8840, 836, 8, 341, 77333, 23502, 1669, 14563, 23502, 16094, 2233, 354, 1669, 17439, 23502, 515, 197, 197, 5, 16712, 23502, 345, 197, 630, 77333, 23502, 8071, 445, 1925, 2052, 497, 7860, ...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
1
func TestValidateCognitoProviderDeveloperName(t *testing.T) { validValues := []string{ "1", "foo", "1.2", "foo1-bar2-baz3", "foo_bar", } for _, s := range validValues { _, errors := validateCognitoProviderDeveloperName(s, "developer_provider_name") if len(errors) > 0 { t.Fatalf("%q should be a valid Cognito Provider Developer Name: %v", s, errors) } } invalidValues := []string{ "foo!", "foo:bar", "foo/bar", "foo;bar", } for _, s := range invalidValues { _, errors := validateCognitoProviderDeveloperName(s, "developer_provider_name") if len(errors) == 0 { t.Fatalf("%q should not be a valid Cognito Provider Developer Name: %v", s, errors) } } }
explode_data.jsonl/78622
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 282 }
[ 2830, 3393, 17926, 34, 63441, 5179, 44911, 675, 1155, 353, 8840, 836, 8, 341, 56322, 6227, 1669, 3056, 917, 515, 197, 197, 1, 16, 756, 197, 197, 1, 7975, 756, 197, 197, 1, 16, 13, 17, 756, 197, 197, 1, 7975, 16, 15773, 17, 1455,...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
5
func TestCloseEnvStreamsClosesAll(t *testing.T) { sp := &mockStreamProvider{credentialOfDesiredType: config.SDKKey("")} store := makeMockStore(nil, nil) es := NewEnvStreams([]StreamProvider{sp}, store, 0, ldlog.NewDisabledLoggers()) sdkKey1, sdkKey2, sdkKey3 := config.SDKKey("sdk-key1"), config.SDKKey("sdk-key2"), config.SDKKey("sdk-key3") es.AddCredential(sdkKey1) es.AddCredential(sdkKey2) es.AddCredential(sdkKey3) require.Len(t, sp.createdStreams, 3) esp1, esp2, esp3 := sp.createdStreams[0], sp.createdStreams[1], sp.createdStreams[2] es.RemoveCredential(sdkKey2) esp2.closed = false assert.False(t, esp1.closed) assert.False(t, esp3.closed) es.Close() assert.True(t, esp1.closed) assert.True(t, esp3.closed) assert.False(t, esp2.closed) }
explode_data.jsonl/69847
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 328 }
[ 2830, 3393, 7925, 14359, 73576, 34, 49341, 2403, 1155, 353, 8840, 836, 8, 341, 41378, 1669, 609, 16712, 3027, 5179, 90, 66799, 2124, 4896, 2690, 929, 25, 2193, 46822, 1592, 39047, 630, 57279, 1669, 1281, 11571, 6093, 27907, 11, 2092, 34...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
1
func TestCreateObjects(t *testing.T) { items := []runtime.Object{} items = append(items, &api.Pod{ TypeMeta: api.TypeMeta{APIVersion: "v1beta1", Kind: "Pod"}, ObjectMeta: api.ObjectMeta{Name: "test-pod"}, }) items = append(items, &api.Service{ TypeMeta: api.TypeMeta{APIVersion: "v1beta1", Kind: "Service"}, ObjectMeta: api.ObjectMeta{Name: "test-service"}, }) typer, mapper := getTyperAndMapper() client, s := getFakeClient(t, []string{"/api/v1beta1/pods", "/api/v1beta1/services"}) errs := CreateObjects(typer, mapper, client, items) s.Close() if len(errs) != 0 { t.Errorf("Unexpected errors during config.Create(): %v", errs) } }
explode_data.jsonl/58836
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 262 }
[ 2830, 3393, 4021, 11543, 1155, 353, 8840, 836, 8, 341, 46413, 1669, 3056, 22255, 8348, 31483, 46413, 284, 8737, 24337, 11, 609, 2068, 88823, 515, 197, 27725, 12175, 25, 256, 6330, 10184, 12175, 90, 7082, 5637, 25, 330, 85, 16, 19127, ...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
2
func TestRuntime_cleanupState(t *testing.T) { ctrl := gomock.NewController(t) defer ctrl.Finish() cfg := newDefaultStandaloneConfig(t) cfg.StorageBase.GRPC.Port = 3904 standalone := NewStandaloneRuntime("test-version", &cfg) s := standalone.(*runtime) repoFactory := state.NewMockRepositoryFactory(ctrl) s.repoFactory = repoFactory repoFactory.EXPECT().CreateBrokerRepo(gomock.Any()).Return(nil, fmt.Errorf("err")) err := standalone.Run() assert.Error(t, err) s.Stop() repo := state.NewMockRepository(ctrl) repoFactory.EXPECT().CreateBrokerRepo(gomock.Any()).Return(repo, nil).AnyTimes() repoFactory.EXPECT().CreateStorageRepo(gomock.Any()).Return(repo, nil).AnyTimes() repo.EXPECT().Delete(gomock.Any(), gomock.Any()).Return(fmt.Errorf("err")).AnyTimes() repo.EXPECT().Close().Return(fmt.Errorf("err")).AnyTimes() err = s.cleanupState() assert.Error(t, err) }
explode_data.jsonl/3484
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 332 }
[ 2830, 3393, 15123, 42444, 1397, 1155, 353, 8840, 836, 8, 341, 84381, 1669, 342, 316, 1176, 7121, 2051, 1155, 340, 16867, 23743, 991, 18176, 2822, 50286, 1669, 501, 3675, 623, 84112, 2648, 1155, 340, 50286, 43771, 3978, 1224, 29528, 43013,...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
1
func TestBlockSerialize(t *testing.T) { tests := []struct { in *MsgBlock // Message to encode out *MsgBlock // Expected decoded message buf []byte // Serialized data txLocs []TxLoc // Expected transaction locations }{ { &blockOne, &blockOne, blockOneBytes, blockOneTxLocs, }, } t.Logf("Running %d tests", len(tests)) for i, test := range tests { // Serialize the block. var buf bytes.Buffer err := test.in.Serialize(&buf) if err != nil { t.Errorf("Serialize #%d error %v", i, err) continue } if !bytes.Equal(buf.Bytes(), test.buf) { t.Errorf("Serialize #%d\n got: %s want: %s", i, spew.Sdump(buf.Bytes()), spew.Sdump(test.buf)) continue } // Deserialize the block. var block MsgBlock rbuf := bytes.NewReader(test.buf) err = block.Deserialize(rbuf) if err != nil { t.Errorf("Deserialize #%d error %v", i, err) continue } if !reflect.DeepEqual(&block, test.out) { t.Errorf("Deserialize #%d\n got: %s want: %s", i, spew.Sdump(&block), spew.Sdump(test.out)) continue } // Deserialize the block while gathering transaction location // information. var txLocBlock MsgBlock br := bytes.NewBuffer(test.buf) txLocs, err := txLocBlock.DeserializeTxLoc(br) if err != nil { t.Errorf("DeserializeTxLoc #%d error %v", i, err) continue } if !reflect.DeepEqual(&txLocBlock, test.out) { t.Errorf("DeserializeTxLoc #%d\n got: %s want: %s", i, spew.Sdump(&txLocBlock), spew.Sdump(test.out)) continue } if !reflect.DeepEqual(txLocs, test.txLocs) { t.Errorf("DeserializeTxLoc #%d\n got: %s want: %s", i, spew.Sdump(txLocs), spew.Sdump(test.txLocs)) continue } } }
explode_data.jsonl/16745
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 752 }
[ 2830, 3393, 4713, 15680, 1155, 353, 8840, 836, 8, 341, 78216, 1669, 3056, 1235, 341, 197, 17430, 257, 353, 6611, 4713, 442, 4856, 311, 16164, 198, 197, 13967, 262, 353, 6611, 4713, 442, 31021, 29213, 1943, 198, 197, 26398, 262, 3056, ...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
9
func TestDeleteJob(t *testing.T) { store, manager, job := initWithJob(t) defer store.Close() err := manager.DeleteJob(job.UUID) assert.Nil(t, err) _, err = manager.GetJob(job.UUID) assert.Equal(t, codes.NotFound, err.(*util.UserError).ExternalStatusCode()) assert.Contains(t, err.Error(), "Job 123 not found") }
explode_data.jsonl/28385
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 122 }
[ 2830, 3393, 6435, 12245, 1155, 353, 8840, 836, 8, 341, 57279, 11, 6645, 11, 2618, 1669, 13864, 12245, 1155, 340, 16867, 3553, 10421, 741, 9859, 1669, 6645, 18872, 12245, 28329, 39636, 340, 6948, 59678, 1155, 11, 1848, 692, 197, 6878, 18...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
1
func TestSarifPresenterImage(t *testing.T) { var buffer bytes.Buffer pres := createImagePresenter(t) // run presenter err := pres.Present(&buffer) if err != nil { t.Fatal(err) } actual := buffer.Bytes() if *update { testutils.UpdateGoldenFileContents(t, actual) } var expected = testutils.GetGoldenFileContents(t) // remove dynamic values, which are tested independently actual = redact(actual) expected = redact(expected) assert.JSONEq(t, string(expected), string(actual)) }
explode_data.jsonl/25493
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 165 }
[ 2830, 3393, 50, 277, 333, 33849, 1906, 1155, 353, 8840, 836, 8, 341, 2405, 4147, 5820, 22622, 271, 3223, 416, 1669, 1855, 1906, 33849, 1155, 692, 197, 322, 1598, 33656, 198, 9859, 1669, 1652, 1069, 2695, 2099, 7573, 340, 743, 1848, 96...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
3
func TestIncrementProposalNumber(t *testing.T) { mapp, keeper, _, _, _, _ := getMockApp(t, 0, GenesisState{}, nil) header := abci.Header{Height: mapp.LastBlockHeight() + 1} mapp.BeginBlock(abci.RequestBeginBlock{Header: header}) ctx := mapp.BaseApp.NewContext(false, abci.Header{}) tp := testProposal() keeper.SubmitProposal(ctx, tp) keeper.SubmitProposal(ctx, tp) keeper.SubmitProposal(ctx, tp) keeper.SubmitProposal(ctx, tp) keeper.SubmitProposal(ctx, tp) proposal6, err := keeper.SubmitProposal(ctx, tp) require.NoError(t, err) require.Equal(t, uint64(6), proposal6.GetProposalID()) }
explode_data.jsonl/60865
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 233 }
[ 2830, 3393, 38311, 98637, 2833, 1155, 353, 8840, 836, 8, 341, 2109, 676, 11, 53416, 11, 8358, 8358, 8358, 716, 1669, 633, 11571, 2164, 1155, 11, 220, 15, 11, 40788, 1397, 22655, 2092, 692, 20883, 1669, 668, 5855, 15753, 90, 3640, 25, ...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
1
func TestParser_ToGeometry(t *testing.T) { p := ParseObjFile("./dodecahedron.obj") g := p.ToGeometry(false) if len(g.GetShapes()) != 1 { t.Errorf("Expected optimized to Geometry dodecahedron to contain 1 main subshapes, got : %d", len(g.GetShapes())) } }
explode_data.jsonl/80536
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 109 }
[ 2830, 3393, 6570, 38346, 20787, 1155, 353, 8840, 836, 8, 341, 3223, 1669, 14775, 5261, 1703, 13988, 67, 534, 924, 41009, 2248, 21232, 1138, 3174, 1669, 281, 3274, 20787, 3576, 692, 743, 2422, 3268, 2234, 92193, 2140, 961, 220, 16, 341, ...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
2
func TestLayoutManager_SetSessions(t *testing.T) { tests := []struct { name string sessions []*container.Session wantLen int }{ { name: "no session given", sessions: []*container.Session{}, wantLen: 0, }, { name: "single session given", sessions: []*container.Session{{Name: "test1"}}, wantLen: 1, }, { name: "multiple sessions given", sessions: []*container.Session{{Name: "test1"}, {Name: "test2"}, {Name: "test3"}, {Name: "test4"}}, wantLen: 4, }, } for _, tt := range tests { t.Run(tt.name, func(t *testing.T) { lm := &LayoutManager{ App: tview.NewApplication(), Grid: tview.NewGrid(), } got := lm.SetSessions(tt.sessions) assert.Equal(t, len(got.Sessions), tt.wantLen) }) } }
explode_data.jsonl/73012
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 354 }
[ 2830, 3393, 48748, 14812, 59062, 1155, 353, 8840, 836, 8, 341, 78216, 1669, 3056, 1235, 341, 197, 11609, 257, 914, 198, 197, 1903, 8551, 29838, 3586, 20674, 198, 197, 50780, 11271, 220, 526, 198, 197, 59403, 197, 197, 515, 298, 11609, ...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
1
func TestAssessRunStatusErrorMessageAnalysisPhaseFailInDryRunMode(t *testing.T) { status, message, dryRunSummary := StartAssessRunStatusErrorMessageAnalysisPhaseFail(t, true) assert.Equal(t, v1alpha1.AnalysisPhaseSuccessful, status) assert.Equal(t, "", message) expectedDryRunSummary := v1alpha1.RunSummary{ Count: 2, Successful: 1, Failed: 1, Inconclusive: 0, Error: 0, } assert.Equal(t, &expectedDryRunSummary, dryRunSummary) }
explode_data.jsonl/75843
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 185 }
[ 2830, 3393, 5615, 433, 6727, 2522, 21349, 26573, 30733, 19524, 641, 85215, 6727, 3636, 1155, 353, 8840, 836, 8, 341, 23847, 11, 1943, 11, 9058, 6727, 19237, 1669, 5145, 5615, 433, 6727, 2522, 21349, 26573, 30733, 19524, 1155, 11, 830, 3...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
1
func TestIsUserExist(t *testing.T) { // prepare mock and service mock := NewMockUserService(t) service := NewUserService(mock) // EXPECT SUCCESS will simulated normal operation with no error return // this simulation expect all process goes as expected t.Run("EXPECT SUCCESS", func(t *testing.T){ // actual method call got := service.IsUserExist(u[0].Username,u[0].Email) // test verification and validation assert.Equal(t, true, got) }) // EXPECT SUCCESS record not found. Simulated by forcing to return error // by setting wantErr=true so the result will be false t.Run("EXPECT SUCCESS data not found", func(t *testing.T){ // actual method call (method to test) wantErr = true got := service.IsUserExist(u[0].Username,u[0].Email) wantErr = false assert.Equal(t, false, got) }) // EXPECT FAIL email invalid. Simulated by inserting invalid mail t.Run("EXPECT SUCCESS data not found", func(t *testing.T){ // actual method call (method to test) got := service.IsUserExist(u[0].Username, "aaa.com") assert.Equal(t, false, got) }) }
explode_data.jsonl/30948
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 459 }
[ 2830, 3393, 3872, 1474, 25613, 1155, 353, 8840, 836, 8, 341, 262, 442, 10549, 7860, 323, 2473, 198, 262, 7860, 1669, 1532, 11571, 60004, 1155, 340, 262, 2473, 1669, 1532, 60004, 30389, 692, 262, 442, 8921, 33941, 686, 45736, 4622, 5666,...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
1
func TestRequirementDefinitionAlien(t *testing.T) { t.Parallel() log.SetDebug(true) data := `NodeType: requirements: - server_endpoint: starlings.capabilities.ConsulServer relationship_type: starlings.relationships.ConnectsConsulAgentToServer lower_bound: 0 upper_bound: 1 capability_name: server - wan_endpoint: starlings.capabilities.ConsulServerWAN relationship_type: starlings.relationships.ConnectsConsulServerWAN lower_bound: 0 upper_bound: UNBOUNDED capability_name: server ` nodes := make(map[string]ReqDefTestNode) err := yaml.Unmarshal([]byte(data), &nodes) log.Printf("%+v", nodes) require.Nil(t, err) require.Contains(t, nodes, "NodeType") node := nodes["NodeType"] require.Len(t, node.Requirements, 2) require.Contains(t, node.Requirements[0], "server_endpoint") req := node.Requirements[0]["server_endpoint"] require.Equal(t, "starlings.capabilities.ConsulServer", req.Capability) require.Equal(t, "starlings.relationships.ConnectsConsulAgentToServer", req.Relationship) require.Equal(t, uint64(0), req.Occurrences.LowerBound) require.Equal(t, uint64(1), req.Occurrences.UpperBound) require.Contains(t, node.Requirements[1], "wan_endpoint") req = node.Requirements[1]["wan_endpoint"] require.Equal(t, "starlings.capabilities.ConsulServerWAN", req.Capability) require.Equal(t, "starlings.relationships.ConnectsConsulServerWAN", req.Relationship) require.Equal(t, uint64(0), req.Occurrences.LowerBound) require.Equal(t, uint64(UNBOUNDED), req.Occurrences.UpperBound) require.Equal(t, "server", req.CapabilityName) }
explode_data.jsonl/77579
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 635 }
[ 2830, 3393, 75802, 10398, 17662, 268, 1155, 353, 8840, 836, 8, 341, 3244, 41288, 7957, 741, 6725, 4202, 7939, 3715, 340, 8924, 1669, 1565, 66137, 510, 262, 8502, 510, 414, 481, 3538, 36699, 25, 6774, 18812, 27388, 8456, 94594, 360, 5475...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
1
func TestGetDeploymentConfigsFromSelector(t *testing.T) { tests := []struct { name string selector string label map[string]string wantErr bool }{ { name: "true case", selector: "app.kubernetes.io/name=app", label: map[string]string{ "app.kubernetes.io/name": "app", }, wantErr: false, }, { name: "true case", selector: "app.kubernetes.io/name=app1", label: map[string]string{ "app.kubernetes.io/name": "app", }, wantErr: false, }, } listOfDC := appsv1.DeploymentConfigList{ Items: []appsv1.DeploymentConfig{ { ObjectMeta: metav1.ObjectMeta{ Labels: map[string]string{ "app.kubernetes.io/name": "app", }, }, }, }, } for _, tt := range tests { t.Run(tt.name, func(t *testing.T) { fakeClient, fakeClientSet := FakeNew() fakeClientSet.AppsClientset.PrependReactor("list", "deploymentconfigs", func(action ktesting.Action) (bool, runtime.Object, error) { if !reflect.DeepEqual(action.(ktesting.ListAction).GetListRestrictions().Labels.String(), tt.selector) { return true, nil, fmt.Errorf("labels not matching with expected values, expected:%s, got:%s", tt.selector, action.(ktesting.ListAction).GetListRestrictions()) } return true, &listOfDC, nil }) dc, err := fakeClient.GetDeploymentConfigsFromSelector(tt.selector) if len(fakeClientSet.AppsClientset.Actions()) != 1 { t.Errorf("expected 1 AppsClientset.Actions() in GetDeploymentConfigsFromSelector, got: %v", fakeClientSet.AppsClientset.Actions()) } if tt.wantErr == false && err != nil { t.Errorf("test failed, %#v", dc[0].Labels) } for _, dc1 := range dc { if !reflect.DeepEqual(dc1.Labels, tt.label) { t.Errorf("labels are not matching with expected labels, expected: %s, got %s", tt.label, dc1.Labels) } } }) } }
explode_data.jsonl/65167
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 810 }
[ 2830, 3393, 1949, 75286, 84905, 3830, 5877, 1155, 353, 8840, 836, 8, 341, 78216, 1669, 3056, 1235, 341, 197, 11609, 257, 914, 198, 197, 197, 8925, 914, 198, 197, 29277, 262, 2415, 14032, 30953, 198, 197, 50780, 7747, 220, 1807, 198, 1...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
2
func TestInsertUser(t *testing.T) { for i:=1; i<10000000;i++{ fmt.Print(":", i) un := getRandomString() fmt.Print(" username:", un) algorithm, _ := encrypt.NewHMACAlgorithm(crypto.SHA256, encrypt.HmacKey) pwd, _ := algorithm.Encrypt("123456") fmt.Println(" pwd:", pwd) dao.InsertUser(&model.User{Username:un, Password:pwd, Nickname:"", CreateTime:time.Now()}) } }
explode_data.jsonl/19321
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 173 }
[ 2830, 3393, 13780, 1474, 1155, 353, 8840, 836, 8, 341, 2023, 600, 14209, 16, 26, 600, 27, 16, 15, 15, 15, 15, 15, 15, 15, 4696, 1027, 515, 197, 11009, 7918, 445, 12147, 600, 692, 197, 20479, 1669, 52436, 703, 741, 197, 11009, 7918...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
2
func TestAddToArchiveWithBadFilePath(t *testing.T) { dir, err := ioutil.TempDir("", "tarwriter_test") if err != nil { assert.FailNow(t, "Cannot create temp dir", err.Error()) } tempFilePath := filepath.Join(dir, "test_file.tar") defer os.RemoveAll(dir) w := tarfile.NewWriter(tempFilePath) defer w.Close() err = w.Open() assert.Nil(t, err) if _, err := os.Stat(w.PathToTarFile); os.IsNotExist(err) { assert.Fail(t, "Tar file does not exist at %s", w.PathToTarFile) } // This file doesn't exist. Make sure we get the right error. err = w.AddToArchive(pathToTestFile("this_file_does_not_exist"), "file1.json") if err == nil { assert.FailNow(t, "Should have gotten a tar write error") } assert.True(t, strings.Contains(err.Error(), "no such file or directory")) }
explode_data.jsonl/75877
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 302 }
[ 2830, 3393, 2212, 1249, 42502, 2354, 17082, 19090, 1155, 353, 8840, 836, 8, 341, 48532, 11, 1848, 1669, 43144, 65009, 6184, 19814, 330, 26737, 18189, 4452, 1138, 743, 1848, 961, 2092, 341, 197, 6948, 57243, 7039, 1155, 11, 330, 17444, 1...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
4
func TestApplicationConfigSchemaDefinitionIsValid(t *testing.T) { schema := NewApplicationConfigResourceHandle().MetaData().Schema schemaAssert := testutils.NewTerraformSchemaAssert(schema, t) schemaAssert.AssertSchemaIsRequiredAndOfTypeString(ApplicationConfigFieldLabel) schemaAssert.AssertSchemaIsComputedAndOfTypeString(ApplicationConfigFieldFullLabel) schemaAssert.AssertSchemaIsOptionalAndOfTypeStringWithDefault(ApplicationConfigFieldScope, string(restapi.ApplicationConfigScopeIncludeNoDownstream)) schemaAssert.AssertSchemaIsOptionalAndOfTypeStringWithDefault(ApplicationConfigFieldBoundaryScope, string(restapi.BoundaryScopeDefault)) schemaAssert.AssertSchemaIsOptionalAndOfTypeString(ApplicationConfigFieldMatchSpecification) require.Equal(t, []string{ApplicationConfigFieldMatchSpecification, ApplicationConfigFieldTagFilter}, schema[ApplicationConfigFieldMatchSpecification].ExactlyOneOf) schemaAssert.AssertSchemaIsOptionalAndOfTypeString(ApplicationConfigFieldTagFilter) require.Equal(t, []string{ApplicationConfigFieldMatchSpecification, ApplicationConfigFieldTagFilter}, schema[ApplicationConfigFieldTagFilter].ExactlyOneOf) }
explode_data.jsonl/64916
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 307 }
[ 2830, 3393, 4988, 2648, 8632, 10398, 55470, 1155, 353, 8840, 836, 8, 341, 1903, 3416, 1669, 1532, 4988, 2648, 4783, 6999, 1005, 37307, 1005, 8632, 271, 1903, 3416, 8534, 1669, 1273, 6031, 7121, 51, 13886, 627, 8632, 8534, 42735, 11, 259...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
1
func TestRenderTiDBInitStartScript(t *testing.T) { tests := []struct { name string path string clusterDomain string result string }{ { name: "basic", path: "cluster01-pd:2379", clusterDomain: "", result: `#!/bin/sh # This script is used to start tidb containers in kubernetes cluster # Use DownwardAPIVolumeFiles to store informations of the cluster: # https://kubernetes.io/docs/tasks/inject-data-application/downward-api-volume-expose-pod-information/#the-downward-api # # runmode="normal/debug" # set -uo pipefail ANNOTATIONS="/etc/podinfo/annotations" if [[ ! -f "${ANNOTATIONS}" ]] then echo "${ANNOTATIONS} does't exist, exiting." exit 1 fi source ${ANNOTATIONS} 2>/dev/null runmode=${runmode:-normal} if [[ X${runmode} == Xdebug ]] then echo "entering debug mode." tail -f /dev/null fi # Use HOSTNAME if POD_NAME is unset for backward compatibility. POD_NAME=${POD_NAME:-$HOSTNAME} ARGS="--store=tikv \ --advertise-address=${POD_NAME}.${HEADLESS_SERVICE_NAME}.${NAMESPACE}.svc \ --host=0.0.0.0 \ --path=cluster01-pd:2379 \ --config=/etc/tidb/tidb.toml " if [[ X${BINLOG_ENABLED:-} == Xtrue ]] then ARGS="${ARGS} --enable-binlog=true" fi SLOW_LOG_FILE=${SLOW_LOG_FILE:-""} if [[ ! -z "${SLOW_LOG_FILE}" ]] then ARGS="${ARGS} --log-slow-query=${SLOW_LOG_FILE:-}" fi echo "start tidb-server ..." echo "/tidb-server ${ARGS}" exec /tidb-server ${ARGS} `, }, { name: "basic with cluster domain", path: "cluster01-pd:2379", clusterDomain: "test.com", result: `#!/bin/sh # This script is used to start tidb containers in kubernetes cluster # Use DownwardAPIVolumeFiles to store informations of the cluster: # https://kubernetes.io/docs/tasks/inject-data-application/downward-api-volume-expose-pod-information/#the-downward-api # # runmode="normal/debug" # set -uo pipefail ANNOTATIONS="/etc/podinfo/annotations" if [[ ! -f "${ANNOTATIONS}" ]] then echo "${ANNOTATIONS} does't exist, exiting." exit 1 fi source ${ANNOTATIONS} 2>/dev/null runmode=${runmode:-normal} if [[ X${runmode} == Xdebug ]] then echo "entering debug mode." tail -f /dev/null fi # Use HOSTNAME if POD_NAME is unset for backward compatibility. POD_NAME=${POD_NAME:-$HOSTNAME} pd_url="cluster01-pd:2379" encoded_domain_url=$(echo $pd_url | base64 | tr "\n" " " | sed "s/ //g") discovery_url="${CLUSTER_NAME}-discovery.${NAMESPACE}.svc.test.com:10261" until result=$(wget -qO- -T 3 http://${discovery_url}/verify/${encoded_domain_url} 2>/dev/null | sed 's/http:\/\///g'); do echo "waiting for the verification of PD endpoints ..." sleep $((RANDOM % 5)) done ARGS="--store=tikv \ --advertise-address=${POD_NAME}.${HEADLESS_SERVICE_NAME}.${NAMESPACE}.svc.test.com \ --host=0.0.0.0 \ --path=${result} \ --config=/etc/tidb/tidb.toml " if [[ X${BINLOG_ENABLED:-} == Xtrue ]] then ARGS="${ARGS} --enable-binlog=true" fi SLOW_LOG_FILE=${SLOW_LOG_FILE:-""} if [[ ! -z "${SLOW_LOG_FILE}" ]] then ARGS="${ARGS} --log-slow-query=${SLOW_LOG_FILE:-}" fi echo "start tidb-server ..." echo "/tidb-server ${ARGS}" exec /tidb-server ${ARGS} `, }, } for _, tt := range tests { t.Run(tt.name, func(t *testing.T) { model := TidbStartScriptModel{ EnablePlugin: false, ClusterDomain: tt.clusterDomain, Path: "cluster01-pd:2379", } script, err := RenderTiDBStartScript(&model) if err != nil { t.Fatal(err) } if diff := cmp.Diff(tt.result, script); diff != "" { t.Errorf("unexpected (-want, +got): %s", diff) } }) } }
explode_data.jsonl/62181
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 1560 }
[ 2830, 3393, 6750, 45351, 3506, 3803, 3479, 5910, 1155, 353, 8840, 836, 8, 341, 78216, 1669, 3056, 1235, 341, 197, 11609, 688, 914, 198, 197, 26781, 688, 914, 198, 197, 197, 18855, 13636, 914, 198, 197, 9559, 286, 914, 198, 197, 59403,...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
3
func TestDownsamplerAggregationWithRulesStore(t *testing.T) { testDownsampler := newTestDownsampler(t, testDownsamplerOptions{}) rulesStore := testDownsampler.rulesStore // Create rules nss, err := rulesStore.ReadNamespaces() require.NoError(t, err) _, err = nss.AddNamespace("default", testUpdateMetadata()) require.NoError(t, err) rule := view.MappingRule{ ID: "mappingrule", Name: "mappingrule", Filter: "app:test*", AggregationID: aggregation.MustCompressTypes(testAggregationType), StoragePolicies: testAggregationStoragePolicies, } rs := rules.NewEmptyRuleSet("default", testUpdateMetadata()) _, err = rs.AddMappingRule(rule, testUpdateMetadata()) require.NoError(t, err) err = rulesStore.WriteAll(nss, rs) require.NoError(t, err) logger := testDownsampler.instrumentOpts.Logger(). WithFields(xlog.NewField("test", t.Name())) // Wait for mapping rule to appear logger.Infof("waiting for mapping rules to propagate") matcher := testDownsampler.matcher testMatchID := newTestID(t, map[string]string{ "__name__": "foo", "app": "test123", }) for { now := time.Now().UnixNano() res := matcher.ForwardMatch(testMatchID, now, now+1) results := res.ForExistingIDAt(now) if !results.IsDefault() { break } time.Sleep(100 * time.Millisecond) } // Test expected output testDownsamplerAggregation(t, testDownsampler) }
explode_data.jsonl/9265
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 539 }
[ 2830, 3393, 4454, 82, 34501, 9042, 34442, 2354, 26008, 6093, 1155, 353, 8840, 836, 8, 341, 18185, 4454, 82, 34501, 1669, 501, 2271, 4454, 82, 34501, 1155, 11, 1273, 4454, 82, 34501, 3798, 37790, 7000, 2425, 6093, 1669, 1273, 4454, 82, ...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
3
func TestAuthEdgeCases(t *testing.T) { t.Run("ReadConfig/MissedConfig", func(t *testing.T) { cnfg := &AuthCnfg{} if err := cnfg.ReadConfig("wrong_path.json"); err == nil { t.Error("wrong_path config should not pass") } }) t.Run("ReadConfig/MissedConfig", func(t *testing.T) { cnfg := &AuthCnfg{} folderPath := u.ResolveCnfgPath("./tmp") filePath := u.ResolveCnfgPath("./tmp/private.azurecert.malformed.json") _ = os.MkdirAll(folderPath, os.ModePerm) _ = ioutil.WriteFile(filePath, []byte("not a json"), 0644) if err := cnfg.ReadConfig(filePath); err == nil { t.Error("malformed config should not pass") } _ = os.RemoveAll(filePath) }) t.Run("WriteConfig", func(t *testing.T) { folderPath := u.ResolveCnfgPath("./tmp") filePath := u.ResolveCnfgPath("./tmp/private.azurecert.json") cnfg := &AuthCnfg{ SiteURL: "test", } _ = os.MkdirAll(folderPath, os.ModePerm) if err := cnfg.WriteConfig(filePath); err != nil { t.Error(err) } _ = os.RemoveAll(filePath) }) }
explode_data.jsonl/80908
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 444 }
[ 2830, 3393, 5087, 11656, 37302, 1155, 353, 8840, 836, 8, 1476, 3244, 16708, 445, 4418, 2648, 10270, 1038, 291, 2648, 497, 2915, 1155, 353, 8840, 836, 8, 341, 197, 1444, 77, 4817, 1669, 609, 5087, 34, 77, 4817, 16094, 197, 743, 1848, ...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
2
func TestValidateProof(t *testing.T) { testMachines := []string{ "opcodetestmath.ao", "opcodetestlogic.ao", "opcodetesthash.ao", "opcodetestethhash2.ao", "opcodeteststack.ao", "opcodetestdup.ao", "opcodetesttuple.ao", } ethCon, err := setupTestValidateProof(t) if err != nil { t.Fatal(err) } for _, machName := range testMachines { machName := machName // capture range variable t.Run(machName, func(t *testing.T) { //t.Parallel() runTestValidateProof(t, machName, ethCon) }) } }
explode_data.jsonl/48493
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 232 }
[ 2830, 3393, 17926, 31076, 1155, 353, 8840, 836, 8, 341, 18185, 44, 70142, 1669, 3056, 917, 515, 197, 197, 1, 453, 20116, 57824, 10374, 13, 3441, 756, 197, 197, 1, 453, 20116, 57824, 24225, 13, 3441, 756, 197, 197, 1, 453, 20116, 578...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
1
func TestAmbientCaps(t *testing.T) { // Make sure we are running as root so we have permissions to use unshare // and create a network namespace. if os.Getuid() != 0 { t.Skip("kernel prohibits unshare in unprivileged process, unless using user namespace") } testAmbientCaps(t, false) }
explode_data.jsonl/36124
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 91 }
[ 2830, 3393, 54032, 1167, 60741, 1155, 353, 8840, 836, 8, 341, 197, 322, 7405, 2704, 582, 525, 4303, 438, 3704, 773, 582, 614, 8541, 311, 990, 650, 19368, 198, 197, 322, 323, 1855, 264, 3922, 4473, 624, 743, 2643, 2234, 2423, 368, 96...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
2
func TestPgRepository_List(t *testing.T) { app1ID := "aec0e9c5-06da-4625-9f8a-bda17ab8c3b9" app2ID := "ccdbef8f-b97a-490c-86e2-2bab2862a6e4" appEntity1 := fixDetailedEntityApplication(t, app1ID, givenTenant(), "App 1", "App desc 1") appEntity2 := fixDetailedEntityApplication(t, app2ID, givenTenant(), "App 2", "App desc 2") appModel1 := fixDetailedModelApplication(t, app1ID, givenTenant(), "App 1", "App desc 1") appModel2 := fixDetailedModelApplication(t, app2ID, givenTenant(), "App 2", "App desc 2") inputPageSize := 3 inputCursor := "" totalCount := 2 pageableQuery := `^SELECT (.+) FROM public\.applications WHERE tenant_id=\$1 ORDER BY id LIMIT %d OFFSET %d$` countQuery := `SELECT COUNT\(\*\) FROM public\.applications WHERE tenant_id=\$1` t.Run("Success", func(t *testing.T) { // given rows := sqlmock.NewRows([]string{"id", "tenant_id", "name", "description", "status_condition", "status_timestamp", "healthcheck_url", "integration_system_id"}). AddRow(appEntity1.ID, appEntity1.TenantID, appEntity1.Name, appEntity1.Description, appEntity1.StatusCondition, appEntity1.StatusTimestamp, appEntity1.HealthCheckURL, appEntity1.IntegrationSystemID). AddRow(appEntity2.ID, appEntity2.TenantID, appEntity2.Name, appEntity2.Description, appEntity2.StatusCondition, appEntity2.StatusTimestamp, appEntity2.HealthCheckURL, appEntity2.IntegrationSystemID) sqlxDB, sqlMock := testdb.MockDatabase(t) defer sqlMock.AssertExpectations(t) sqlMock.ExpectQuery(fmt.Sprintf(pageableQuery, inputPageSize, 0)). WithArgs(givenTenant()). WillReturnRows(rows) sqlMock.ExpectQuery(countQuery). WithArgs(givenTenant()). WillReturnRows(sqlmock.NewRows([]string{"count"}).AddRow(2)) ctx := persistence.SaveToContext(context.TODO(), sqlxDB) conv := &automock.EntityConverter{} conv.On("FromEntity", appEntity2).Return(appModel2).Once() conv.On("FromEntity", appEntity1).Return(appModel1).Once() defer conv.AssertExpectations(t) pgRepository := application.NewRepository(conv) // when modelApp, err := pgRepository.List(ctx, givenTenant(), nil, inputPageSize, inputCursor) // then require.NoError(t, err) require.Len(t, modelApp.Data, 2) assert.Equal(t, appEntity1.ID, modelApp.Data[0].ID) assert.Equal(t, appEntity2.ID, modelApp.Data[1].ID) assert.Equal(t, "", modelApp.PageInfo.StartCursor) assert.Equal(t, totalCount, modelApp.TotalCount) }) t.Run("DB Error", func(t *testing.T) { // given sqlxDB, sqlMock := testdb.MockDatabase(t) defer sqlMock.AssertExpectations(t) sqlMock.ExpectQuery(fmt.Sprintf(pageableQuery, inputPageSize, 0)). WithArgs(givenTenant()). WillReturnError(givenError()) ctx := persistence.SaveToContext(context.TODO(), sqlxDB) conv := &automock.EntityConverter{} defer conv.AssertExpectations(t) pgRepository := application.NewRepository(conv) // when _, err := pgRepository.List(ctx, givenTenant(), nil, inputPageSize, inputCursor) //then require.Error(t, err) require.Contains(t, err.Error(), "while fetching list of objects from DB: some error") }) }
explode_data.jsonl/52676
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 1172 }
[ 2830, 3393, 82540, 4624, 27104, 1155, 353, 8840, 836, 8, 341, 28236, 16, 915, 1669, 330, 71221, 15, 68, 24, 66, 20, 12, 15, 21, 3235, 12, 19, 21, 17, 20, 12, 24, 69, 23, 64, 1455, 3235, 16, 22, 370, 23, 66, 18, 65, 24, 698, ...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
1
func TestKazaamTransformThreeOpWithOver(t *testing.T) { spec := `[{ "operation": "shift", "spec":{"a": "key.array1[0].array2[*]"} }, { "operation": "concat", "over": "a", "spec": {"sources": [{"path": "foo"}, {"value": "KEY"}], "targetPath": "url", "delim": ":" } }, { "operation": "shift", "spec": {"urls": "a[*].url" } }]` jsonIn := `{"key":{"array1":[{"array2":[{"foo":0},{"foo":1},{"foo":2}]}]}}` jsonOut := `{"urls":["0:KEY","1:KEY","2:KEY"]}` kazaamTransform, _ := kazaam.NewKazaam(spec) kazaamOut, _ := kazaamTransform.TransformJSONStringToString(jsonIn) areEqual, _ := checkJSONStringsEqual(kazaamOut, jsonOut) if !areEqual { t.Error("Transformed data does not match expectation.") t.Log("Expected: ", jsonOut) t.Log("Actual: ", kazaamOut) t.FailNow() } }
explode_data.jsonl/11864
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 345 }
[ 2830, 3393, 42, 12707, 309, 8963, 19641, 7125, 2354, 1918, 1155, 353, 8840, 836, 8, 341, 98100, 1669, 77644, 515, 197, 197, 1, 9262, 788, 330, 13418, 756, 197, 197, 1, 9535, 22317, 64, 788, 330, 792, 7234, 16, 58, 15, 936, 1653, 1...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
2
func TestLoadAbsolutePath(t *testing.T) { exported := packagestest.Export(t, packagestest.GOPATH, []packagestest.Module{{ Name: "golang.org/gopatha", Files: map[string]interface{}{ "a/a.go": `package a`, }}, { Name: "golang.org/gopathb", Files: map[string]interface{}{ "b/b.go": `package b`, }}}) defer exported.Cleanup() initial, err := packages.Load(exported.Config, filepath.Dir(exported.File("golang.org/gopatha", "a/a.go")), filepath.Dir(exported.File("golang.org/gopathb", "b/b.go"))) if err != nil { t.Fatalf("failed to load imports: %v", err) } got := []string{} for _, p := range initial { got = append(got, p.ID) } sort.Strings(got) want := []string{"golang.org/gopatha/a", "golang.org/gopathb/b"} if !reflect.DeepEqual(got, want) { t.Fatalf("initial packages loaded: got [%s], want [%s]", got, want) } }
explode_data.jsonl/45179
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 371 }
[ 2830, 3393, 5879, 39211, 1155, 353, 8840, 836, 8, 341, 59440, 291, 1669, 6328, 267, 477, 81077, 1155, 11, 6328, 267, 477, 1224, 3067, 4827, 11, 3056, 1722, 267, 477, 26958, 90, 515, 197, 21297, 25, 330, 70, 37287, 2659, 4846, 35111, ...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
4
func TestTabletServerPrimaryToReplica(t *testing.T) { // Reuse code from tx_executor_test. _, tsv, db := newTestTxExecutor(t) defer tsv.StopService() defer db.Close() target := querypb.Target{TabletType: topodatapb.TabletType_PRIMARY} txid1, _, err := tsv.Begin(ctx, &target, nil) require.NoError(t, err) _, err = tsv.Execute(ctx, &target, "update test_table set `name` = 2 where pk = 1", nil, txid1, 0, nil) require.NoError(t, err) err = tsv.Prepare(ctx, &target, txid1, "aa") require.NoError(t, err) txid2, _, err := tsv.Begin(ctx, &target, nil) require.NoError(t, err) // This makes txid2 busy conn2, err := tsv.te.txPool.GetAndLock(txid2, "for query") require.NoError(t, err) ch := make(chan bool) go func() { tsv.SetServingType(topodatapb.TabletType_REPLICA, time.Time{}, true, "") ch <- true }() // SetServingType must rollback the prepared transaction, // but it must wait for the unprepared (txid2) to become non-busy. select { case <-ch: t.Fatal("ch should not fire") case <-time.After(10 * time.Millisecond): } require.EqualValues(t, 1, tsv.te.txPool.scp.active.Size(), "tsv.te.txPool.scp.active.Size()") // Concluding conn2 will allow the transition to go through. tsv.te.txPool.RollbackAndRelease(ctx, conn2) <-ch }
explode_data.jsonl/79981
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 517 }
[ 2830, 3393, 2556, 83, 5475, 15972, 1249, 18327, 15317, 1155, 353, 8840, 836, 8, 341, 197, 322, 1032, 810, 2038, 504, 9854, 81207, 4452, 624, 197, 6878, 259, 3492, 11, 2927, 1669, 501, 2271, 31584, 25255, 1155, 340, 16867, 259, 3492, 3...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
1
func TestCheckNever(t *testing.T) { t.Parallel() _, err := ParseAndCheckWithPanic(t, ` pub fun test(): Int { return panic("XXX") } `, ) require.NoError(t, err) }
explode_data.jsonl/47440
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 117 }
[ 2830, 3393, 3973, 26155, 1155, 353, 8840, 836, 8, 1476, 3244, 41288, 7957, 2822, 197, 6878, 1848, 1669, 14775, 3036, 3973, 2354, 47, 31270, 1155, 345, 197, 197, 3989, 310, 6675, 2464, 1273, 4555, 1333, 341, 394, 470, 21975, 445, 30100, ...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1 ]
1
func TestPartialValuesNode(t *testing.T) { integration.ProgramTest(t, &integration.ProgramTestOptions{ Dir: filepath.Join("partial_values", "nodejs"), Dependencies: []string{"@pulumi/pulumi"}, AllowEmptyPreviewChanges: true, }) }
explode_data.jsonl/76375
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 117 }
[ 2830, 3393, 37314, 6227, 1955, 1155, 353, 8840, 836, 8, 341, 2084, 17376, 80254, 2271, 1155, 11, 609, 60168, 80254, 2271, 3798, 515, 197, 197, 6184, 25, 2549, 26054, 22363, 445, 37420, 9146, 497, 330, 3509, 2519, 4461, 197, 197, 48303, ...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
1
func TestStartInvalidDogStatsD(t *testing.T) { metricAgent := &ServerlessMetricAgent{} defer metricAgent.Stop() metricAgent.Start(1*time.Second, &MetricConfig{}, &MetricDogStatsDMocked{}) assert.False(t, metricAgent.IsReady()) // allow some time to stop to avoid 'can't listen: listen udp 127.0.0.1:8125: bind: address already in use' time.Sleep(1 * time.Second) }
explode_data.jsonl/50622
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 131 }
[ 2830, 3393, 3479, 7928, 48940, 16635, 35, 1155, 353, 8840, 836, 8, 341, 2109, 16340, 16810, 1669, 609, 5475, 1717, 54310, 16810, 16094, 16867, 18266, 16810, 30213, 741, 2109, 16340, 16810, 12101, 7, 16, 77053, 32435, 11, 609, 54310, 2648,...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
1
func TestGetProxyListProviderGetSingleIps(t *testing.T) { ips, err := GetProxyListProviderSingleton.GetProxyList() if err != nil { t.Errorf("Failed to getProxyIp,because of %s", err.Error()) return } for _, ip := range ips { t.Logf("successfully getProxyIp from %s : %s://%s:%s", ip.Refer, ip.Schema, ip.IP, ip.Port) } }
explode_data.jsonl/68786
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 134 }
[ 2830, 3393, 1949, 16219, 852, 5179, 1949, 10888, 40, 1690, 1155, 353, 8840, 836, 8, 341, 197, 3077, 11, 1848, 1669, 2126, 16219, 852, 5179, 25915, 2234, 16219, 852, 741, 743, 1848, 961, 2092, 341, 197, 3244, 13080, 445, 9408, 311, 633...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
3
func TestVirtualService_InvalidEventKind(t *testing.T) { g := NewGomegaWithT(t) o := processing.ProcessorOptions{ DomainSuffix: "cluster.local", MeshConfig: meshConfig(), } xform, src, acc := setupVS(g, o) xform.Start() defer xform.Stop() src.Handlers.Handle(event.FullSyncFor(collections.K8SExtensionsV1Beta1Ingresses)) src.Handlers.Handle(event.Event{Kind: 55}) g.Eventually(acc.Events).Should(ConsistOf( event.FullSyncFor(collections.IstioNetworkingV1Alpha3Virtualservices), )) }
explode_data.jsonl/71125
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 191 }
[ 2830, 3393, 33026, 1860, 62, 7928, 1556, 10629, 1155, 353, 8840, 836, 8, 341, 3174, 1669, 1532, 38, 32696, 2354, 51, 1155, 692, 22229, 1669, 8692, 29012, 269, 3798, 515, 197, 10957, 3121, 40177, 25, 330, 18855, 11033, 756, 197, 9209, ...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
1
func Test_cliOptions(t *testing.T) { api := operations.LunaformAPI{} assert.Empty(t, api.CommandLineOptionsGroups) configureFlags(&api) assert.Len(t, api.CommandLineOptionsGroups, 1) opt := api.CommandLineOptionsGroups[0] assert.Equal(t, "Terraform Server", opt.ShortDescription) assert.Equal(t, "Server Configuration", opt.LongDescription) assert.NotNil(t, opt.Options) assert.IsType(t, &ConfigFileFlags{}, opt.Options) }
explode_data.jsonl/75683
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 155 }
[ 2830, 3393, 47147, 3798, 1155, 353, 8840, 836, 8, 341, 54299, 1669, 7525, 1214, 8565, 627, 7082, 31483, 6948, 11180, 1155, 11, 6330, 12714, 2460, 3798, 22173, 692, 197, 21002, 9195, 2099, 2068, 692, 6948, 65819, 1155, 11, 6330, 12714, 2...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
1
func TestHTMLKeepWhitespace(t *testing.T) { htmlTests := []struct { html string expected string }{ {`cats and dogs `, `cats and dogs`}, {` <div> <i> test </i> <b> test </b> </div> `, `<div> <i> test </i> <b> test </b> </div>`}, {`<strong>x </strong>y`, `<strong>x </strong>y`}, {`<strong>x </strong> y`, `<strong>x </strong> y`}, {"<strong>x </strong>\ny", "<strong>x </strong>\ny"}, {`<p>x </p>y`, `<p>x </p>y`}, {`x <p>y</p>`, `x <p>y`}, {` <!doctype html> <!--comment--> <html> <body><p></p></body></html> `, `<!doctype html><p>`}, // spaces before html and at the start of html are dropped {`<p>x<br> y`, `<p>x<br> y`}, {`<p>x </b> <b> y`, `<p>x </b> <b> y`}, {`a <code>code</code> b`, `a <code>code</code> b`}, {`a <code></code> b`, `a <code></code> b`}, {`a <script>script</script> b`, `a <script>script</script> b`}, {"text\n<!--comment-->\ntext", "text\ntext"}, {"text\n<!--comment-->text<!--comment--> text", "text\ntext text"}, {"abc\n</body>\ndef", "abc\ndef"}, {"<x>\n<!--y-->\n</x>", "<x>\n</x>"}, {"<style>lala{color:red}</style>", "<style>lala{color:red}</style>"}, } m := minify.New() htmlMinifier := &Minifier{KeepWhitespace: true} for _, tt := range htmlTests { t.Run(tt.html, func(t *testing.T) { r := bytes.NewBufferString(tt.html) w := &bytes.Buffer{} err := htmlMinifier.Minify(m, w, r, nil) test.Minify(t, tt.html, err, w.String(), tt.expected) }) } }
explode_data.jsonl/59585
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 692 }
[ 2830, 3393, 5835, 19434, 73804, 1155, 353, 8840, 836, 8, 341, 36126, 18200, 1669, 3056, 1235, 341, 197, 36126, 257, 914, 198, 197, 42400, 914, 198, 197, 59403, 197, 197, 90, 63, 37452, 220, 323, 220, 2698, 26307, 90190, 1565, 37452, 3...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
1
func TestScaleUpAndDownInParallelStressTest(t *testing.T) { t.Parallel() ctx := context.Background() client := framework.AgonesClient.AgonesV1() fleetCount := 2 fleetSize := int32(10) defaultReplicas := int32(1) repeatCount := 3 deadline := time.Now().Add(1 * time.Minute) logrus.WithField("fleetCount", fleetCount). WithField("fleetSize", fleetSize). WithField("repeatCount", repeatCount). WithField("deadline", deadline). Info("starting scale up/down test") if framework.StressTestLevel > 0 { fleetSize = 10 * int32(framework.StressTestLevel) repeatCount = 10 fleetCount = 10 deadline = time.Now().Add(45 * time.Minute) } var fleets []*agonesv1.Fleet scaleUpStats := framework.NewStatsCollector(fmt.Sprintf("fleet_%v_scale_up", fleetSize), framework.Version) scaleDownStats := framework.NewStatsCollector(fmt.Sprintf("fleet_%v_scale_down", fleetSize), framework.Version) defer scaleUpStats.Report() defer scaleDownStats.Report() for fleetNumber := 0; fleetNumber < fleetCount; fleetNumber++ { flt := defaultFleet(framework.Namespace) flt.ObjectMeta.GenerateName = fmt.Sprintf("scale-fleet-%v-", fleetNumber) if fleetNumber%2 == 0 { // even-numbered fleets starts at fleetSize and are scaled down to zero and back. flt.Spec.Replicas = fleetSize } else { // odd-numbered fleets starts at default 1 replica and are scaled up to fleetSize and back. flt.Spec.Replicas = defaultReplicas } flt, err := client.Fleets(framework.Namespace).Create(ctx, flt, metav1.CreateOptions{}) if assert.Nil(t, err) { defer client.Fleets(framework.Namespace).Delete(ctx, flt.ObjectMeta.Name, metav1.DeleteOptions{}) // nolint:errcheck } fleets = append(fleets, flt) } // wait for initial fleet conditions. for fleetNumber, flt := range fleets { if fleetNumber%2 == 0 { framework.AssertFleetCondition(t, flt, e2e.FleetReadyCount(fleetSize)) } else { framework.AssertFleetCondition(t, flt, e2e.FleetReadyCount(defaultReplicas)) } } errorsChan := make(chan error) var wg sync.WaitGroup finished := make(chan bool, 1) for fleetNumber, flt := range fleets { wg.Add(1) go func(fleetNumber int, flt *agonesv1.Fleet) { defer wg.Done() defer func() { if err := recover(); err != nil { t.Errorf("recovered panic: %v", err) } }() if fleetNumber%2 == 0 { duration, err := scaleAndWait(ctx, t, flt, 0) if err != nil { fmt.Println(err) errorsChan <- err return } scaleDownStats.ReportDuration(duration, nil) } for i := 0; i < repeatCount; i++ { if time.Now().After(deadline) { break } duration, err := scaleAndWait(ctx, t, flt, fleetSize) if err != nil { fmt.Println(err) errorsChan <- err return } scaleUpStats.ReportDuration(duration, nil) duration, err = scaleAndWait(ctx, t, flt, 0) if err != nil { fmt.Println(err) errorsChan <- err return } scaleDownStats.ReportDuration(duration, nil) } }(fleetNumber, flt) } go func() { wg.Wait() close(finished) }() select { case <-finished: case err := <-errorsChan: t.Fatalf("Error in waiting for a fleet to scale: %s", err) } fmt.Println("We are Done") }
explode_data.jsonl/15428
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 1265 }
[ 2830, 3393, 6947, 2324, 3036, 4454, 641, 16547, 623, 673, 2271, 1155, 353, 8840, 836, 8, 341, 3244, 41288, 7957, 741, 20985, 1669, 2266, 19047, 2822, 25291, 1669, 12626, 49850, 3154, 2959, 49850, 3154, 53, 16, 741, 1166, 18973, 2507, 16...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
2
func TestBuildExportError(t *testing.T) { testServer(t, func(c *stdsdk.Client, p *structs.MockProvider) { p.On("BuildExport", "app1", "build1", mock.Anything).Return(fmt.Errorf("err1")) res, err := c.GetStream("/apps/app1/builds/build1.tgz", stdsdk.RequestOptions{}) require.EqualError(t, err, "err1") require.Nil(t, res) }) }
explode_data.jsonl/71418
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 142 }
[ 2830, 3393, 11066, 16894, 1454, 1155, 353, 8840, 836, 8, 341, 18185, 5475, 1155, 11, 2915, 1337, 353, 1834, 51295, 11716, 11, 281, 353, 1235, 82, 24664, 5179, 8, 341, 197, 3223, 8071, 445, 11066, 16894, 497, 330, 676, 16, 497, 330, ...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
1
func TestProhibitedVendorSyncTCF2(t *testing.T) { vendorListData := tcf2MarshalVendorList(buildTCF2VendorList34()) perms := permissionsImpl{ cfg: tcf2Config, vendorIDs: map[openrtb_ext.BidderName]uint16{ openrtb_ext.BidderAppnexus: 2, openrtb_ext.BidderPubmatic: 6, openrtb_ext.BidderRubicon: 8, openrtb_ext.BidderOpenx: 10, }, fetchVendorList: map[uint8]func(ctx context.Context, id uint16) (vendorlist.VendorList, error){ tcf1SpecVersion: nil, tcf2SpecVersion: listFetcher(map[uint16]vendorlist.VendorList{ 34: parseVendorListDataV2(t, vendorListData), }), }, } perms.cfg.HostVendorID = 10 // COzTVhaOzTVhaGvAAAENAiCIAP_AAH_AAAAAAEEUACCKAAA : TCF2 with full consents to purposes for vendors 2, 6, 8 allowSync, err := perms.HostCookiesAllowed(context.Background(), "COzTVhaOzTVhaGvAAAENAiCIAP_AAH_AAAAAAEEUACCKAAA") assert.NoErrorf(t, err, "Error processing HostCookiesAllowed") assert.EqualValuesf(t, false, allowSync, "HostCookiesAllowed failure") // Permission disallowed due to consent string not including vendor 10. allowSync, err = perms.BidderSyncAllowed(context.Background(), openrtb_ext.BidderOpenx, "COzTVhaOzTVhaGvAAAENAiCIAP_AAH_AAAAAAEEUACCKAAA") assert.NoErrorf(t, err, "Error processing BidderSyncAllowed") assert.EqualValuesf(t, false, allowSync, "BidderSyncAllowed failure") }
explode_data.jsonl/46169
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 551 }
[ 2830, 3393, 1336, 92517, 44691, 12154, 7749, 37, 17, 1155, 353, 8840, 836, 8, 341, 5195, 8029, 852, 1043, 1669, 259, 9792, 17, 55438, 44691, 852, 43333, 7749, 37, 17, 44691, 852, 18, 19, 2398, 197, 87772, 1669, 8541, 9673, 515, 197, ...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
1
func TestNonRBACTypes(t *testing.T) { f := fakeGRTranslator{"crontabs"} tests := []struct { name string configs []api.ResourceSpec validator fakeGRTranslator allow bool }{ { name: "Correct Non-RBAC resources config", configs: []api.ResourceSpec{ {Group: "", Resource: "secrets", Mode: "Ignore"}, {Group: "", Resource: "resourcequotas"}, }, validator: f, allow: true, }, { name: "Resource does not exist", configs: []api.ResourceSpec{ // "crontabs" resource does not exist in "" {Group: "", Resource: "crontabs", Mode: "Ignore"}, }, validator: f, allow: false, }, { name: "Duplicate resources with different modes", configs: []api.ResourceSpec{ {Group: "", Resource: "secrets", Mode: "Ignore"}, {Group: "", Resource: "secrets", Mode: "Propagate"}, }, validator: f, allow: false, }, { name: "Duplicate resources with the same mode", configs: []api.ResourceSpec{ {Group: "", Resource: "secrets", Mode: "Ignore"}, {Group: "", Resource: "secrets", Mode: "Ignore"}, }, validator: f, allow: false, }} for _, tc := range tests { t.Run(tc.name, func(t *testing.T) { g := NewWithT(t) c := &api.HNCConfiguration{Spec: api.HNCConfigurationSpec{Resources: tc.configs}} c.Name = api.HNCConfigSingleton config := &HNCConfig{ translator: tc.validator, Forest: forest.NewForest(), Log: zap.New(), } got := config.handle(context.Background(), c) logResult(t, got.AdmissionResponse.Result) g.Expect(got.AdmissionResponse.Allowed).Should(Equal(tc.allow)) }) } }
explode_data.jsonl/11112
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 704 }
[ 2830, 3393, 8121, 29259, 6823, 1804, 1155, 353, 8840, 836, 8, 341, 1166, 1669, 12418, 8626, 51653, 4913, 5082, 544, 3435, 16707, 78216, 1669, 3056, 1235, 341, 197, 11609, 414, 914, 198, 197, 25873, 82, 256, 3056, 2068, 20766, 8327, 198,...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
1
func TestDimension(t *testing.T) { var ts *Tensor vv22 := []interface{}{[]int{1, 2, 3}, []float64{4.0, 5.5, 2}, []string{"a", "b", "c"}} ts = NewTensor(vv22) t.Logf("%s", ts.String()) }
explode_data.jsonl/20816
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 90 }
[ 2830, 3393, 26121, 1155, 353, 8840, 836, 8, 341, 2405, 10591, 353, 25336, 198, 5195, 85, 17, 17, 1669, 3056, 4970, 6257, 90, 1294, 396, 90, 16, 11, 220, 17, 11, 220, 18, 2137, 3056, 3649, 21, 19, 90, 19, 13, 15, 11, 220, 20, 1...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
1
func TestTeamsService_EditTeamBySlug_RemoveParent(t *testing.T) { client, mux, _, teardown := setup() defer teardown() input := NewTeam{Name: "n", Privacy: String("closed")} var body string mux.HandleFunc("/orgs/o/teams/s", func(w http.ResponseWriter, r *http.Request) { v := new(NewTeam) buf, err := ioutil.ReadAll(r.Body) if err != nil { t.Errorf("Unable to read body: %v", err) } body = string(buf) json.NewDecoder(bytes.NewBuffer(buf)).Decode(v) testMethod(t, r, "PATCH") if !cmp.Equal(v, &input) { t.Errorf("Request body = %+v, want %+v", v, input) } fmt.Fprint(w, `{"id":1}`) }) ctx := context.Background() team, _, err := client.Teams.EditTeamBySlug(ctx, "o", "s", input, true) if err != nil { t.Errorf("Teams.EditTeam returned error: %v", err) } want := &Team{ID: Int64(1)} if !cmp.Equal(team, want) { t.Errorf("Teams.EditTeam returned %+v, want %+v", team, want) } if want := `{"name":"n","parent_team_id":null,"privacy":"closed"}` + "\n"; body != want { t.Errorf("Teams.EditTeam body = %+v, want %+v", body, want) } }
explode_data.jsonl/4519
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 469 }
[ 2830, 3393, 60669, 1860, 66158, 14597, 1359, 54968, 66843, 8387, 1155, 353, 8840, 836, 8, 341, 25291, 11, 59807, 11, 8358, 49304, 1669, 6505, 741, 16867, 49304, 2822, 22427, 1669, 1532, 14597, 63121, 25, 330, 77, 497, 18874, 25, 923, 44...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
3
func TestHello(t *testing.T) { // t.Helper()とは...? // ヘルパーとして必要な文 // t.Helperを書かずに失敗させると、failした行数がt.Errorfを書いた行になってしまう assertCorrectMessage := func(t *testing.T, got, want string) { t.Helper() if got != want { t.Errorf("got %q want %q", got, want) } } // t.Runとは...? // t.Run("テスト名", 無名関数)でサブテストができるよ // サブサブテストもできるよ t.Run("saying hello to people", func(t *testing.T) { got := Hello("Chris", "") want := "Hello, Chris" assertCorrectMessage(t, got, want) t.Run("sub sub test", func(t *testing.T) { got := Hello("Suna", "") want := "Hello, Suna" assertCorrectMessage(t, got, want) }) }) t.Run("empty string defaults to 'World'", func(t *testing.T) { got := Hello("", "") want := "Hello, World" assertCorrectMessage(t, got, want) }) t.Run("in Spanish", func(t *testing.T) { got := Hello("Elodie", "Spanish") want := "Hola, Elodie" assertCorrectMessage(t, got, want) }) t.Run("in French", func(t *testing.T) { got := Hello("Gabriel", "French") want := "Bonjour, Gabriel" assertCorrectMessage(t, got, want) }) }
explode_data.jsonl/14231
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 511 }
[ 2830, 3393, 9707, 1155, 353, 8840, 836, 8, 341, 197, 322, 259, 69282, 368, 126238, 1112, 5267, 197, 322, 20711, 246, 32610, 130072, 125445, 133538, 16744, 198, 197, 322, 259, 69282, 29412, 102171, 31049, 133173, 20726, 115263, 125240, 12636...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
2
func TestUpdateWhitelist(t *testing.T) { installFixtures() // Insert by specifying a record (struct) p := Person{Name: "Barack"} p.Foo = "bar" var foo string var name string var id int64 err := testDB. InsertInto("people"). Whitelist("name", "foo"). Record(p). Returning("id", "name", "foo"). QueryScalar(&id, &name, &foo) assert.NoError(t, err) assert.True(t, id > 0) assert.Equal(t, name, "Barack") assert.Equal(t, foo, "bar") p2 := Person{Name: "oy"} p2.Foo = "bah" var name2 string var foo2 string err = testDB. Update("people"). SetWhitelist(p2, "foo"). Where("id = $1", id). Returning("name", "foo"). QueryScalar(&name2, &foo2) assert.NoError(t, err) assert.True(t, id > 0) assert.Equal(t, name2, "Barack") assert.Equal(t, foo2, "bah") }
explode_data.jsonl/80348
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 341 }
[ 2830, 3393, 4289, 1639, 57645, 1155, 353, 8840, 836, 8, 341, 197, 12248, 25958, 18513, 2822, 197, 322, 17101, 553, 37838, 264, 3255, 320, 1235, 340, 3223, 1669, 7357, 63121, 25, 330, 3428, 473, 16707, 3223, 991, 2624, 284, 330, 2257, ...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
1
func TestRBACModelWithDomainsAtRuntimeMockAdapter(t *testing.T) { adapter := fileadapter.NewAdapterMock("examples/rbac_with_domains_policy.csv") e, _ := NewEnforcer("examples/rbac_with_domains_model.conf", adapter) _, _ = e.AddPolicy("admin", "domain3", "data1", "read") _, _ = e.AddGroupingPolicy("alice", "admin", "domain3") testDomainEnforce(t, e, "alice", "domain3", "data1", "read", true) testDomainEnforce(t, e, "alice", "domain1", "data1", "read", true) _, _ = e.RemoveFilteredPolicy(1, "domain1", "data1") testDomainEnforce(t, e, "alice", "domain1", "data1", "read", false) testDomainEnforce(t, e, "bob", "domain2", "data2", "read", true) _, _ = e.RemovePolicy("admin", "domain2", "data2", "read") testDomainEnforce(t, e, "bob", "domain2", "data2", "read", false) }
explode_data.jsonl/57125
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 313 }
[ 2830, 3393, 29259, 1706, 1712, 2354, 74713, 1655, 15123, 11571, 5940, 1155, 353, 8840, 836, 8, 341, 197, 19731, 1669, 1034, 19731, 7121, 5940, 11571, 445, 51668, 7382, 55877, 6615, 70199, 22773, 11219, 1138, 7727, 11, 716, 1669, 1532, 170...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
1
func TestDeepValidate_ExtraMasterZone(t *testing.T) { c := buildDefaultCluster(t) c.Spec.Subnets = []kopsapi.ClusterSubnetSpec{ {Name: "mock1a", Zone: "us-mock-1a", CIDR: "172.20.1.0/24"}, {Name: "mock1b", Zone: "us-mock-1b", CIDR: "172.20.2.0/24"}, } var groups []*kopsapi.InstanceGroup groups = append(groups, buildMinimalMasterInstanceGroup("subnet-us-mock-1a")) groups = append(groups, buildMinimalMasterInstanceGroup("subnet-us-mock-1b")) groups = append(groups, buildMinimalMasterInstanceGroup("subnet-us-mock-1c")) groups = append(groups, buildMinimalNodeInstanceGroup("subnet-us-mock-1a", "subnet-us-mock-1b")) expectErrorFromDeepValidate(t, c, groups, "spec.subnets[0]: Not found: \"subnet-us-mock-1a\"") }
explode_data.jsonl/65780
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 297 }
[ 2830, 3393, 33464, 17926, 62, 11612, 18041, 15363, 1155, 353, 8840, 836, 8, 341, 1444, 1669, 1936, 3675, 28678, 1155, 340, 1444, 36473, 12391, 52861, 284, 3056, 74, 3721, 2068, 72883, 3136, 4711, 8327, 515, 197, 197, 63121, 25, 330, 167...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
1
func TestGitCommandGetCommitsToPush(t *testing.T) { type scenario struct { testName string command func(string, ...string) *exec.Cmd test func(map[string]bool) } scenarios := []scenario{ { "Can't retrieve pushable commits", func(string, ...string) *exec.Cmd { return exec.Command("test") }, func(pushables map[string]bool) { assert.EqualValues(t, map[string]bool{}, pushables) }, }, { "Retrieve pushable commits", func(cmd string, args ...string) *exec.Cmd { return exec.Command("echo", "8a2bb0e\n78976bc") }, func(pushables map[string]bool) { assert.Len(t, pushables, 2) assert.EqualValues(t, map[string]bool{"8a2bb0e": true, "78976bc": true}, pushables) }, }, } for _, s := range scenarios { t.Run(s.testName, func(t *testing.T) { gitCmd := newDummyGitCommand() gitCmd.OSCommand.command = s.command s.test(gitCmd.GetCommitsToPush()) }) } }
explode_data.jsonl/38362
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 401 }
[ 2830, 3393, 46562, 4062, 1949, 17977, 1199, 1249, 16644, 1155, 353, 8840, 836, 8, 341, 13158, 15048, 2036, 341, 197, 18185, 675, 914, 198, 197, 45566, 220, 2915, 3609, 11, 2503, 917, 8, 353, 11748, 64512, 198, 197, 18185, 257, 2915, 9...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
1
func TestHandshakeServerSNI(t *testing.T) { test := &serverTest{ name: "SNI", command: []string{"openssl", "s_client", "-no_ticket", "-cipher", "AES128-SHA", "-servername", "snitest.com"}, } runServerTestTLS12(t, test) }
explode_data.jsonl/36340
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 97 }
[ 2830, 3393, 2314, 29661, 5475, 50, 14912, 1155, 353, 8840, 836, 8, 341, 18185, 1669, 609, 4030, 2271, 515, 197, 11609, 25, 262, 330, 50, 14912, 756, 197, 45566, 25, 3056, 917, 4913, 53612, 497, 330, 82, 8179, 497, 6523, 2152, 45718, ...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
1
func TestForm_Extended_CreateRenderer(t *testing.T) { form := &extendedForm{} form.ExtendBaseWidget(form) form.Items = []*FormItem{{Text: "test1", Widget: NewEntry()}} assert.NotNil(t, test.WidgetRenderer(form)) assert.Equal(t, 2, len(form.itemGrid.Objects)) form.Append("test2", NewEntry()) assert.Equal(t, 4, len(form.itemGrid.Objects)) }
explode_data.jsonl/8944
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 140 }
[ 2830, 3393, 1838, 62, 53190, 34325, 11541, 1155, 353, 8840, 836, 8, 341, 37410, 1669, 609, 41098, 1838, 16094, 37410, 16146, 408, 3978, 4548, 16760, 340, 37410, 12054, 284, 29838, 57559, 2979, 1178, 25, 330, 1944, 16, 497, 12980, 25, 15...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
1
func TestAlertFlushing(t *testing.T) { c, s := localPipe(t) done := make(chan bool) clientWCC := &writeCountingConn{Conn: c} serverWCC := &writeCountingConn{Conn: s} serverConfig := testConfig.Clone() // Cause a signature-time error brokenKey := rsa.PrivateKey{PublicKey: testRSAPrivateKey.PublicKey} brokenKey.D = big.NewInt(42) serverConfig.Certificates = []Certificate{{ Certificate: [][]byte{testRSACertificate}, PrivateKey: &brokenKey, }} go func() { Server(serverWCC, serverConfig).Handshake() serverWCC.Close() done <- true }() err := Client(clientWCC, testConfig).Handshake() if err == nil { t.Fatal("client unexpectedly returned no error") } const expectedError = "remote error: tls: internal error" if e := err.Error(); !strings.Contains(e, expectedError) { t.Fatalf("expected to find %q in error but error was %q", expectedError, e) } clientWCC.Close() <-done if n := serverWCC.numWrites; n != 1 { t.Errorf("expected server handshake to complete with one write, but saw %d", n) } }
explode_data.jsonl/27731
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 373 }
[ 2830, 3393, 9676, 3882, 40813, 1155, 353, 8840, 836, 8, 341, 1444, 11, 274, 1669, 2205, 34077, 1155, 340, 40495, 1669, 1281, 35190, 1807, 692, 25291, 54, 3706, 1669, 609, 4934, 2507, 287, 9701, 90, 9701, 25, 272, 532, 41057, 54, 3706,...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
1
func TestGetQName(t *testing.T) { testdata := []struct { input string output string }{ {"hello", "hello"}, {"abc*def", "abc"}, {"abc:def", "abc:def"}, {"abc:def:ghi", "abc:def"}, {"abc_def", "abc_def"}, {"abc-def", "abc-def"}, {"abc·def", "abc·def"}, {"abc‿def", "abc‿def"}, {"a123", "a123"}, } for _, td := range testdata { sr := strings.NewReader(td.input) res, err := getQName(sr) if err != nil { t.Error(err.Error()) } if got, expected := res, td.output; got != expected { t.Errorf("getWord(%s) = %s, want %s", td.input, res, expected) } } }
explode_data.jsonl/36793
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 272 }
[ 2830, 3393, 1949, 48, 675, 1155, 353, 8840, 836, 8, 341, 18185, 691, 1669, 3056, 1235, 341, 197, 22427, 220, 914, 198, 197, 21170, 914, 198, 197, 59403, 197, 197, 4913, 14990, 497, 330, 14990, 7115, 197, 197, 4913, 13683, 9, 750, 49...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
4
func TestAuthOAuth(t *testing.T) { var want = "Bearer myToken" r := URL("http://localhost/") r.Auth("myToken") got := r.Headers.Get("Authorization") if want != got { t.Errorf("Wrong OAuth token. Wanted Bearer %s, got %s instead", want, got) } }
explode_data.jsonl/24733
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 99 }
[ 2830, 3393, 5087, 57850, 1155, 353, 8840, 836, 8, 341, 2405, 1366, 284, 330, 26399, 847, 3323, 698, 7000, 1669, 5548, 445, 1254, 1110, 8301, 14, 5130, 7000, 25233, 445, 2408, 3323, 1138, 3174, 354, 1669, 435, 43968, 2234, 445, 18124, ...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
2
func TestDeleteByQueryBodyNull(t *testing.T) { k, _ := kuzzle.NewKuzzle(&internal.MockedConnection{}, nil) d := document.NewDocument(k) _, err := d.DeleteByQuery("index", "collection", nil, nil) assert.NotNil(t, err) }
explode_data.jsonl/75166
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 83 }
[ 2830, 3393, 6435, 1359, 2859, 5444, 3280, 1155, 353, 8840, 836, 8, 341, 16463, 11, 716, 1669, 595, 14945, 7121, 42, 14945, 2099, 10481, 24664, 291, 4526, 22655, 2092, 340, 2698, 1669, 2197, 7121, 7524, 5969, 692, 197, 6878, 1848, 1669, ...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1 ]
1
func TestStackOutputsDisplayed(t *testing.T) { stdout := &bytes.Buffer{} integration.ProgramTest(t, &integration.ProgramTestOptions{ Dir: filepath.Join("stack_outputs", "nodejs"), Dependencies: []string{"@pulumi/pulumi"}, Quick: false, Verbose: true, Stdout: stdout, ExtraRuntimeValidation: func(t *testing.T, stackInfo integration.RuntimeValidationStackInfo) { output := stdout.String() // ensure we get the outputs info both for the normal update, and for the no-change update. assert.Contains(t, output, "Outputs:\n foo: 42\n xyz: \"ABC\"\n\nResources:\n + 1 created") assert.Contains(t, output, "Outputs:\n foo: 42\n xyz: \"ABC\"\n\nResources:\n 1 unchanged") }, }) }
explode_data.jsonl/76351
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 304 }
[ 2830, 3393, 4336, 61438, 56447, 1155, 353, 8840, 836, 8, 341, 6736, 411, 1669, 609, 9651, 22622, 16094, 2084, 17376, 80254, 2271, 1155, 11, 609, 60168, 80254, 2271, 3798, 515, 197, 197, 6184, 25, 688, 26054, 22363, 445, 7693, 35189, 497...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
1
func TestRouterParam1466(t *testing.T) { e := New() r := e.router r.Add(http.MethodPost, "/users/signup", func(c Context) error { return nil }) r.Add(http.MethodPost, "/users/signup/bulk", func(c Context) error { return nil }) r.Add(http.MethodPost, "/users/survey", func(c Context) error { return nil }) r.Add(http.MethodGet, "/users/:username", func(c Context) error { return nil }) r.Add(http.MethodGet, "/interests/:name/users", func(c Context) error { return nil }) r.Add(http.MethodGet, "/skills/:name/users", func(c Context) error { return nil }) // Additional routes for Issue 1479 r.Add(http.MethodGet, "/users/:username/likes/projects/ids", func(c Context) error { return nil }) r.Add(http.MethodGet, "/users/:username/profile", func(c Context) error { return nil }) r.Add(http.MethodGet, "/users/:username/uploads/:type", func(c Context) error { return nil }) c := e.NewContext(nil, nil).(*context) r.Find(http.MethodGet, "/users/ajitem", c) assert.Equal(t, "ajitem", c.Param("username")) c = e.NewContext(nil, nil).(*context) r.Find(http.MethodGet, "/users/sharewithme", c) assert.Equal(t, "sharewithme", c.Param("username")) c = e.NewContext(nil, nil).(*context) r.Find(http.MethodGet, "/users/signup", c) assert.Equal(t, "", c.Param("username")) // Additional assertions for #1479 c = e.NewContext(nil, nil).(*context) r.Find(http.MethodGet, "/users/sharewithme/likes/projects/ids", c) assert.Equal(t, "sharewithme", c.Param("username")) c = e.NewContext(nil, nil).(*context) r.Find(http.MethodGet, "/users/ajitem/likes/projects/ids", c) assert.Equal(t, "ajitem", c.Param("username")) c = e.NewContext(nil, nil).(*context) r.Find(http.MethodGet, "/users/sharewithme/profile", c) assert.Equal(t, "sharewithme", c.Param("username")) c = e.NewContext(nil, nil).(*context) r.Find(http.MethodGet, "/users/ajitem/profile", c) assert.Equal(t, "ajitem", c.Param("username")) c = e.NewContext(nil, nil).(*context) r.Find(http.MethodGet, "/users/sharewithme/uploads/self", c) assert.Equal(t, "sharewithme", c.Param("username")) assert.Equal(t, "self", c.Param("type")) c = e.NewContext(nil, nil).(*context) r.Find(http.MethodGet, "/users/ajitem/uploads/self", c) assert.Equal(t, "ajitem", c.Param("username")) assert.Equal(t, "self", c.Param("type")) // Issue #1493 - check for routing loop c = e.NewContext(nil, nil).(*context) r.Find(http.MethodGet, "/users/tree/free", c) assert.Equal(t, "", c.Param("id")) assert.Equal(t, 0, c.response.Status) }
explode_data.jsonl/47136
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 996 }
[ 2830, 3393, 9523, 2001, 16, 19, 21, 21, 1155, 353, 8840, 836, 8, 341, 7727, 1669, 1532, 741, 7000, 1669, 384, 22125, 271, 7000, 1904, 19886, 20798, 4133, 11, 3521, 4218, 68763, 497, 2915, 1337, 9608, 8, 1465, 341, 197, 853, 2092, 19...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
1
func TestPeerGroupResolverAcceptAllPolicy(t *testing.T) { sigPolicyEnv := policydsl.AcceptAllPolicy expected := []PeerGroup{ pg(p1), pg(p2), pg(p3), pg(p4), pg(p5), pg(p6), pg(p7), pg(p8), pg(p9), pg(p10), pg(p11), pg(p12), } testPeerGroupResolver(t, sigPolicyEnv, allPeers, expected, nil) }
explode_data.jsonl/21574
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 137 }
[ 2830, 3393, 30888, 2808, 18190, 16646, 2403, 13825, 1155, 353, 8840, 836, 8, 1476, 84841, 13825, 14359, 1669, 4842, 81874, 52265, 2403, 13825, 271, 42400, 1669, 3056, 30888, 2808, 515, 197, 3223, 70, 1295, 16, 701, 17495, 1295, 17, 701, ...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
1
func TestGetTargetsDirRecurseError(t *testing.T) { testDir, err := initTestFiles(map[string]string{ "foo.yaml": `foobar: {}`, "foo_benthos_test.yaml": `tests: [{}]`, "bar.yaml": `foobar: {}`, "bar_benthos_test.yaml": `tests: [{}]`, "nested/baz_benthos_test.yaml": `tests: [{}]`, }) if err != nil { t.Fatal(err) } defer os.RemoveAll(testDir) if _, err = test.GetTestTargets(testDir, "_benthos_test", true); err == nil { t.Error("Expected error") } }
explode_data.jsonl/34066
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 274 }
[ 2830, 3393, 1949, 49030, 6184, 693, 2352, 325, 1454, 1155, 353, 8840, 836, 8, 341, 18185, 6184, 11, 1848, 1669, 2930, 2271, 10809, 9147, 14032, 30953, 515, 197, 197, 1, 7975, 33406, 788, 3824, 1565, 50267, 25, 4687, 12892, 197, 197, 1...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
3
func TestDescribePodSecurityPolicy(t *testing.T) { expected := []string{ "Name:\\s*mypsp", "Allow Privileged:\\s*false", "Default Add Capabilities:\\s*<none>", "Required Drop Capabilities:\\s*<none>", "Allowed Capabilities:\\s*<none>", "Allowed Volume Types:\\s*<none>", "Allow Host Network:\\s*false", "Allow Host Ports:\\s*<none>", "Allow Host PID:\\s*false", "Allow Host IPC:\\s*false", "Read Only Root Filesystem:\\s*false", "SELinux Context Strategy: RunAsAny", "User:\\s*<none>", "Role:\\s*<none>", "Type:\\s*<none>", "Level:\\s*<none>", "Run As User Strategy: RunAsAny", "FSGroup Strategy: RunAsAny", "Supplemental Groups Strategy: RunAsAny", } fake := fake.NewSimpleClientset(&extensions.PodSecurityPolicy{ ObjectMeta: metav1.ObjectMeta{ Name: "mypsp", }, Spec: extensions.PodSecurityPolicySpec{ SELinux: extensions.SELinuxStrategyOptions{ Rule: extensions.SELinuxStrategyRunAsAny, }, RunAsUser: extensions.RunAsUserStrategyOptions{ Rule: extensions.RunAsUserStrategyRunAsAny, }, FSGroup: extensions.FSGroupStrategyOptions{ Rule: extensions.FSGroupStrategyRunAsAny, }, SupplementalGroups: extensions.SupplementalGroupsStrategyOptions{ Rule: extensions.SupplementalGroupsStrategyRunAsAny, }, }, }) c := &describeClient{T: t, Namespace: "", Interface: fake} d := PodSecurityPolicyDescriber{c} out, err := d.Describe("", "mypsp", printers.DescriberSettings{}) if err != nil { t.Fatalf("unexpected error: %v", err) } for _, item := range expected { if matched, _ := regexp.MatchString(item, out); !matched { t.Errorf("Expected to find %q in: %q", item, out) } } }
explode_data.jsonl/34947
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 668 }
[ 2830, 3393, 74785, 23527, 15352, 13825, 1155, 353, 8840, 836, 8, 341, 42400, 1669, 3056, 917, 515, 197, 197, 1, 675, 23817, 82, 32569, 1082, 2154, 756, 197, 197, 1, 18605, 15438, 68431, 23817, 82, 9, 3849, 756, 197, 197, 1, 3675, 26...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
4
func TestAliveMsgStore(t *testing.T) { bootPeers := []string{} peersNum := 2 instances := []*gossipInstance{} aliveMsgs := []*protoext.SignedGossipMessage{} memReqMsgs := []*protoext.SignedGossipMessage{} for i := 0; i < peersNum; i++ { id := fmt.Sprintf("d%d", i) inst := createDiscoveryInstanceWithNoGossip(32610+i, id, bootPeers) instances = append(instances, inst) } // Creating MembershipRequest messages for i := 0; i < peersNum; i++ { memReqMsg, _ := instances[i].discoveryImpl().createMembershipRequest(true) sMsg, _ := protoext.NoopSign(memReqMsg) memReqMsgs = append(memReqMsgs, sMsg) } // Creating Alive messages for i := 0; i < peersNum; i++ { aliveMsg, _ := instances[i].discoveryImpl().createSignedAliveMessage(true) aliveMsgs = append(aliveMsgs, aliveMsg) } //Check new alive msgs for _, msg := range aliveMsgs { assert.True(t, instances[0].discoveryImpl().msgStore.CheckValid(msg), "aliveMsgStore CheckValid returns false on new AliveMsg") } // Add new alive msgs for _, msg := range aliveMsgs { assert.True(t, instances[0].discoveryImpl().msgStore.Add(msg), "aliveMsgStore Add returns false on new AliveMsg") } // Check exist alive msgs for _, msg := range aliveMsgs { assert.False(t, instances[0].discoveryImpl().msgStore.CheckValid(msg), "aliveMsgStore CheckValid returns true on existing AliveMsg") } // Check non-alive msgs for _, msg := range memReqMsgs { assert.Panics(t, func() { instances[1].discoveryImpl().msgStore.CheckValid(msg) }, "aliveMsgStore CheckValid should panic on new MembershipRequest msg") assert.Panics(t, func() { instances[1].discoveryImpl().msgStore.Add(msg) }, "aliveMsgStore Add should panic on new MembershipRequest msg") } }
explode_data.jsonl/62274
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 614 }
[ 2830, 3393, 32637, 6611, 6093, 1155, 353, 8840, 836, 8, 341, 197, 4619, 10197, 388, 1669, 3056, 917, 16094, 197, 375, 388, 4651, 1669, 220, 17, 198, 197, 47825, 1669, 29838, 70, 41473, 2523, 16094, 197, 50961, 6611, 82, 1669, 29838, 1...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
1
func TestNonAutoCommitWithPessimisticMode(t *testing.T) { store, clean := createMockStoreAndSetup(t) defer clean() tk := testkit.NewTestKit(t, store) tk2 := testkit.NewTestKit(t, store) tk.MustExec("use test") tk2.MustExec("use test") tk.MustExec("drop table if exists t1") tk.MustExec("create table t1 (c1 int primary key, c2 int)") tk.MustExec("insert into t1 values (1, 1)") tk.MustExec("set tidb_txn_mode = 'pessimistic'") tk.MustExec("set autocommit = 0") tk.MustQuery("select * from t1 where c2 = 1 for update").Check(testkit.Rows("1 1")) tk2.MustExec("insert into t1 values(2, 1)") tk.MustQuery("select * from t1 where c2 = 1 for update").Check(testkit.Rows("1 1", "2 1")) tk.MustExec("commit") tk2.MustExec("insert into t1 values(3, 1)") tk.MustExec("set tx_isolation = 'read-committed'") tk.MustQuery("select * from t1 where c2 = 1 for update").Check(testkit.Rows("1 1", "2 1", "3 1")) tk2.MustExec("insert into t1 values(4, 1)") tk.MustQuery("select * from t1 where c2 = 1 for update").Check(testkit.Rows("1 1", "2 1", "3 1", "4 1")) tk.MustExec("commit") }
explode_data.jsonl/12477
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 429 }
[ 2830, 3393, 8121, 13253, 33441, 2354, 47, 66733, 4532, 3636, 1155, 353, 8840, 836, 8, 341, 57279, 11, 4240, 1669, 1855, 11571, 6093, 3036, 21821, 1155, 340, 16867, 4240, 2822, 3244, 74, 1669, 1273, 8226, 7121, 2271, 7695, 1155, 11, 3553...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
1
func TestScalarBls12377Point(t *testing.T) { bls12377G1 := BLS12377G1() _, ok := bls12377G1.Scalar.Point().(*PointBls12377G1) require.True(t, ok) bls12377G2 := BLS12377G2() _, ok = bls12377G2.Scalar.Point().(*PointBls12377G2) require.True(t, ok) }
explode_data.jsonl/15761
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 128 }
[ 2830, 3393, 20639, 33, 4730, 16, 17, 18, 22, 22, 2609, 1155, 353, 8840, 836, 8, 341, 96421, 82, 16, 17, 18, 22, 22, 38, 16, 1669, 425, 7268, 16, 17, 18, 22, 22, 38, 16, 741, 197, 6878, 5394, 1669, 1501, 82, 16, 17, 18, 22, ...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
1
func TestStructFieldRestrictions(test *testing.T) { schema, err := parseRDLString(` type Foo Struct { String (pattern="y_*") bar2 (optional); //normal syntax, the options are onthe type String bar (optional, pattern="y_*"); //alternate syntax: the options for the field are applied to type String blah (maxsize=20, minsize=5, x_foo="hey"); String hmm (values=["one","two","three"]) UUID id (values=["901dfb52-39b5-11e7-adba-6c4008a30aa6"], optional) Timestamp ts (values=["2017-05-15T21:30:10.742Z"], optional) Symbol sym (values=["one","two"]) Int32 num (max=100,min=50) } `) if err != nil { test.Errorf("cannot parse valid RDL with resource name: %v", err) } if len(schema.Types) != 9 { test.Errorf("expected 5 types in schema, found %d", len(schema.Types)) } }
explode_data.jsonl/74353
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 309 }
[ 2830, 3393, 9422, 1877, 50360, 21439, 8623, 353, 8840, 836, 8, 341, 1903, 3416, 11, 1848, 1669, 4715, 49, 16524, 703, 61528, 1313, 33428, 16139, 341, 262, 923, 320, 14339, 428, 88, 45797, 899, 3619, 17, 320, 12807, 1215, 442, 8252, 19...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
3
func TestSessionOptionsAreUniquePerSession(t *testing.T) { repo := test.NewRepository(true) ss, err := sessionstore.NewStore(repo, config.ServerConf{ CookieSecrets: []string{"secret"}, }) if err != nil { t.Fatal("Failed to get store", err) } ss.Options.MaxAge = 900 req, err := http.NewRequest("GET", "http://www.example.com", nil) if err != nil { t.Fatal("Failed to create request", err) } session, err := ss.Get(req, "newsess") if err != nil { t.Fatal("Failed to create session", err) } session.Options.MaxAge = -1 if ss.Options.MaxAge != 900 { t.Fatalf("PGStore.Options.MaxAge: expected %d, got %d", 900, ss.Options.MaxAge) } }
explode_data.jsonl/75066
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 254 }
[ 2830, 3393, 5283, 3798, 11526, 22811, 3889, 5283, 1155, 353, 8840, 836, 8, 341, 17200, 5368, 1669, 1273, 7121, 4624, 3715, 692, 34472, 11, 1848, 1669, 3797, 4314, 7121, 6093, 50608, 11, 2193, 22997, 15578, 515, 197, 6258, 9619, 19773, 8...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
5
func TestData(t *testing.T) { compose.EnsureUp(t, "etcd") f := mbtest.NewEventFetcher(t, getConfig()) err := mbtest.WriteEvent(f, t) if err != nil { t.Fatal("write", err) } }
explode_data.jsonl/75689
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 84 }
[ 2830, 93200, 1155, 353, 8840, 836, 8, 341, 32810, 2900, 22834, 19098, 2324, 1155, 11, 330, 295, 4385, 5130, 1166, 1669, 10016, 1944, 7121, 1556, 97492, 1155, 11, 66763, 2398, 9859, 1669, 10016, 1944, 4073, 1556, 955, 11, 259, 340, 743, ...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1 ]
2
func TestReconcileServiceInstanceNamespaceError(t *testing.T) { fakeKubeClient, fakeCatalogClient, fakeClusterServiceBrokerClient, testController, sharedInformers := newTestController(t, noFakeActions()) // prepend to override the default test namespace fakeKubeClient.PrependReactor("get", "namespaces", func(action clientgotesting.Action) (bool, runtime.Object, error) { return true, &corev1.Namespace{}, errors.New("No namespace") }) sharedInformers.ClusterServiceBrokers().Informer().GetStore().Add(getTestClusterServiceBroker()) sharedInformers.ClusterServiceClasses().Informer().GetStore().Add(getTestClusterServiceClass()) sharedInformers.ClusterServicePlans().Informer().GetStore().Add(getTestClusterServicePlan()) instance := getTestServiceInstanceWithClusterRefs() if err := reconcileServiceInstance(t, testController, instance); err == nil { t.Fatalf("There should not be a namespace for the ServiceInstance to be created in") } brokerActions := fakeClusterServiceBrokerClient.Actions() assertNumberOfBrokerActions(t, brokerActions, 0) // verify no kube resources created. // One single action comes from getting namespace uid kubeActions := fakeKubeClient.Actions() if err := checkKubeClientActions(kubeActions, []kubeClientAction{ {verb: "get", resourceName: "namespaces", checkType: checkGetActionType}, }); err != nil { t.Fatal(err) } actions := fakeCatalogClient.Actions() assertNumberOfActions(t, actions, 1) updatedServiceInstance := assertUpdateStatus(t, actions[0], instance) assertServiceInstanceErrorBeforeRequest(t, updatedServiceInstance, errorFindingNamespaceServiceInstanceReason, instance) events := getRecordedEvents(testController) expectedEvent := warningEventBuilder(errorFindingNamespaceServiceInstanceReason).msgf( "Failed to get namespace %q:", "test-ns", ).msg("No namespace") if err := checkEvents(events, expectedEvent.stringArr()); err != nil { t.Fatal(err) } }
explode_data.jsonl/58147
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 580 }
[ 2830, 3393, 693, 40446, 457, 1860, 2523, 22699, 1454, 1155, 353, 8840, 836, 8, 341, 1166, 726, 42, 3760, 2959, 11, 12418, 41606, 2959, 11, 12418, 28678, 1860, 65545, 2959, 11, 1273, 2051, 11, 6094, 37891, 388, 1669, 501, 2271, 2051, 1...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
1
func TestCommitOffsetsWithRetry(t *testing.T) { offsets := offsetStash{"topic": {0: 0}} tests := map[string]struct { Fails int Invocations int HasError bool }{ "happy path": { Invocations: 1, }, "1 retry": { Fails: 1, Invocations: 2, }, "out of retries": { Fails: defaultCommitRetries + 1, Invocations: defaultCommitRetries, HasError: true, }, } for label, test := range tests { t.Run(label, func(t *testing.T) { count := 0 gen := &Generation{ conn: mockCoordinator{ offsetCommitFunc: func(offsetCommitRequestV2) (offsetCommitResponseV2, error) { count++ if count <= test.Fails { return offsetCommitResponseV2{}, io.EOF } return offsetCommitResponseV2{}, nil }, }, done: make(chan struct{}), log: func(func(Logger)) {}, logError: func(func(Logger)) {}, } r := &Reader{stctx: context.Background()} err := r.commitOffsetsWithRetry(gen, offsets, defaultCommitRetries) switch { case test.HasError && err == nil: t.Error("bad err: expected not nil; got nil") case !test.HasError && err != nil: t.Errorf("bad err: expected nil; got %v", err) } }) } }
explode_data.jsonl/80377
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 563 }
[ 2830, 3393, 33441, 81095, 2354, 51560, 1155, 353, 8840, 836, 8, 341, 40668, 82, 1669, 4347, 623, 988, 4913, 16411, 788, 314, 15, 25, 220, 15, 47449, 78216, 1669, 2415, 14032, 60, 1235, 341, 197, 12727, 6209, 981, 526, 198, 197, 197, ...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
2
func TestValueAssignmentTypeFromString(t *testing.T) { type args struct { s string } tests := []struct { name string args args want ValueAssignmentType wantErr bool }{ {"Literal", args{"literal"}, ValueAssignmentLiteral, false}, {"LiteralCase", args{"liTEral"}, ValueAssignmentLiteral, false}, {"Function", args{"function"}, ValueAssignmentFunction, false}, {"FunctionCase", args{"FuNction"}, ValueAssignmentFunction, false}, {"List", args{"list"}, ValueAssignmentList, false}, {"ListCase", args{"LisT"}, ValueAssignmentList, false}, {"Map", args{"map"}, ValueAssignmentMap, false}, {"MapCase", args{"MAP"}, ValueAssignmentMap, false}, {"Empty", args{""}, ValueAssignmentLiteral, true}, {"Wrong", args{"Something"}, ValueAssignmentLiteral, true}, } for _, tt := range tests { t.Run(tt.name, func(t *testing.T) { got, err := ValueAssignmentTypeFromString(tt.args.s) if (err != nil) != tt.wantErr { t.Errorf("ValueAssignmentTypeFromString() error = %v, wantErr %v", err, tt.wantErr) return } if err == nil && got != tt.want { t.Errorf("ValueAssignmentTypeFromString() = %v, want %v", got, tt.want) } }) } }
explode_data.jsonl/64266
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 450 }
[ 2830, 3393, 1130, 41613, 929, 44491, 1155, 353, 8840, 836, 8, 341, 13158, 2827, 2036, 341, 197, 1903, 914, 198, 197, 532, 78216, 1669, 3056, 1235, 341, 197, 11609, 262, 914, 198, 197, 31215, 262, 2827, 198, 197, 50780, 262, 5162, 4161...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
4
func TestIterator(t *testing.T) { tests := []struct { name string key func(int) interface{} }{ {name: "uintptr", key: iKey}, {name: "string", key: sKey}, {name: "[]byte", key: bKey}, } for _, tt := range tests { t.Run(tt.name, func(t *testing.T) { m := &HashMap{} quit := make(chan struct{}) for item := range m.Iter(quit) { t.Errorf("Expected no object but got %v.", item) } close(quit) itemCount := 16 for i := itemCount; i > 0; i-- { m.Set(tt.key(i), &Animal{strconv.Itoa(i)}) } counter := 0 quit = make(chan struct{}) for item := range m.Iter(quit) { val := item.Value if val == nil { t.Error("Expecting an object.") } counter++ } close(quit) if counter != itemCount { t.Error("Returned item count did not match.") } counter2 := 0 itemCountRnd := 0 for itemCountRnd == 0 { itemCountRnd = rand.Intn(itemCount) } quit = make(chan struct{}) for item := range m.Iter(quit) { val := item.Value if val == nil { t.Error("Expecting an object.") } counter2++ if counter2 == itemCountRnd { close(quit) break } } if counter2 != itemCountRnd { t.Error("Returned random item count did not match.", counter2, itemCountRnd) } }) } }
explode_data.jsonl/24431
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 596 }
[ 2830, 3393, 11951, 1155, 353, 8840, 836, 8, 1476, 78216, 1669, 3056, 1235, 341, 197, 11609, 914, 198, 197, 23634, 220, 2915, 1548, 8, 3749, 16094, 197, 59403, 197, 197, 47006, 25, 330, 51380, 497, 1376, 25, 600, 1592, 1583, 197, 197, ...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
1
func TestProviders(t *testing.T) { ps := Providers{ {[]string{"one", "three"}, func(_ ...Option) (Pusher, error) { return nil, nil }}, {[]string{"two", "four"}, func(_ ...Option) (Pusher, error) { return nil, nil }}, } if _, err := ps.ByScheme("one"); err != nil { t.Error(err) } if _, err := ps.ByScheme("four"); err != nil { t.Error(err) } if _, err := ps.ByScheme("five"); err == nil { t.Error("Did not expect handler for five") } }
explode_data.jsonl/54518
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 182 }
[ 2830, 3393, 37351, 1155, 353, 8840, 836, 8, 341, 35009, 1669, 69929, 515, 197, 197, 90, 1294, 917, 4913, 603, 497, 330, 27856, 14345, 2915, 2490, 2503, 5341, 8, 320, 16644, 261, 11, 1465, 8, 314, 470, 2092, 11, 2092, 64395, 197, 197...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
1
func TestAgent(t *testing.T) { for _, keyType := range []string{"rsa", "dsa", "ecdsa"} { testAgent(t, testPrivateKeys[keyType], nil, 0) } }
explode_data.jsonl/20857
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 60 }
[ 2830, 3393, 16810, 1155, 353, 8840, 836, 8, 341, 2023, 8358, 1376, 929, 1669, 2088, 3056, 917, 4913, 60869, 497, 330, 96780, 497, 330, 757, 96780, 9207, 341, 197, 18185, 16810, 1155, 11, 1273, 16787, 8850, 8157, 929, 1125, 2092, 11, 2...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1 ]
2
func TestGenerateMetricTasksFailing(t *testing.T) { run := &v1alpha1.AnalysisRun{ Spec: v1alpha1.AnalysisRunSpec{ Metrics: []v1alpha1.Metric{ { Name: "success-rate", }, { Name: "latency", }, }, }, Status: v1alpha1.AnalysisRunStatus{ Phase: v1alpha1.AnalysisPhaseRunning, MetricResults: []v1alpha1.MetricResult{{ Name: "latency", Phase: v1alpha1.AnalysisPhaseFailed, }}, }, } // ensure we don't perform more measurements when one result already failed tasks := generateMetricTasks(run, run.Spec.Metrics) assert.Equal(t, 0, len(tasks)) run.Status.MetricResults = nil // ensure we schedule tasks when no results are failed tasks = generateMetricTasks(run, run.Spec.Metrics) assert.Equal(t, 2, len(tasks)) }
explode_data.jsonl/75808
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 320 }
[ 2830, 3393, 31115, 54310, 25449, 37, 14277, 1155, 353, 8840, 836, 8, 341, 56742, 1669, 609, 85, 16, 7141, 16, 8624, 9092, 6727, 515, 197, 7568, 992, 25, 348, 16, 7141, 16, 8624, 9092, 6727, 8327, 515, 298, 9209, 13468, 25, 3056, 85,...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
1
func TestCrossShardPoolv2AddCrossShardBlock(t *testing.T) { ResetCrossShardPoolTest() fromShardID := byte(0) toShardID := byte(1) _, _, err1 := crossShardPoolMapTest[toShardID].AddCrossShardBlock(crossShardBlock3WrongShard) if err1 == nil { t.Fatalf("Expect WrongShardIDError but no error") } else { if err1.(*BlockPoolError).Code != ErrCodeMessage[WrongShardIDError].Code { t.Fatalf("Expect %+v error but get %+v", WrongShardIDError, err1) } } temp := make(map[byte]uint64) temp[0] = 4 crossShardPoolMapTest[toShardID].crossShardState = temp _, _, err2 := crossShardPoolMapTest[toShardID].AddCrossShardBlock(crossShardBlock4) if err2 == nil { t.Fatalf("Expect WrongShardIDError but no error") } else { if err2.(*BlockPoolError).Code != ErrCodeMessage[OldBlockError].Code { t.Fatalf("Expect %+v error but get %+v", OldBlockError, err2) } } ResetCrossShardPoolTest() crossShardPoolMapTest[toShardID].validPool[fromShardID] = append(crossShardPoolMapTest[toShardID].validPool[fromShardID], crossShardBlock3) _, _, err3 := crossShardPoolMapTest[toShardID].AddCrossShardBlock(crossShardBlock3) if err3 == nil { t.Fatalf("Expect WrongShardIDError but no error") } else { if err3.(*BlockPoolError).Code != ErrCodeMessage[DuplicateBlockError].Code { t.Fatalf("Expect %+v error but get %+v", DuplicateBlockError, err3) } } crossShardPoolMapTest[toShardID].pendingPool[fromShardID] = append(crossShardPoolMapTest[toShardID].pendingPool[fromShardID], crossShardBlock4) _, _, err4 := crossShardPoolMapTest[toShardID].AddCrossShardBlock(crossShardBlock4) if err4 == nil { t.Fatalf("Expect WrongShardIDError but no error") } else { if err4.(*BlockPoolError).Code != ErrCodeMessage[DuplicateBlockError].Code { t.Fatalf("Expect %+v error but get %+v", DuplicateBlockError, err4) } } }
explode_data.jsonl/74594
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 721 }
[ 2830, 3393, 28501, 2016, 567, 10551, 85, 17, 2212, 28501, 2016, 567, 4713, 1155, 353, 8840, 836, 8, 341, 197, 14828, 28501, 2016, 567, 10551, 2271, 741, 42727, 2016, 567, 915, 1669, 4922, 7, 15, 340, 31709, 2016, 567, 915, 1669, 4922,...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
9
func TestGetFileTimestamps(t *testing.T) { fs := afero.NewMemMapFs() files := []struct { time string name string }{ { time: "2020-09-20T12:00:05Z", }, { time: "2020-09-20T13:00:05Z", name: "_demoname", }, { time: "2020-09-20T14:00:05Z", name: "_testname", }, { time: "2020-09-20T15:00:05Z", }, } afero.WriteFile(fs, configFileName, []byte(validContent), 0666) for index, file := range files { time, _ := time.Parse(time.RFC3339, file.time) upFN := fmt.Sprintf("mig_%d%s_up.sql", time.Unix(), file.name) dnFN := fmt.Sprintf("mig_%d%s_down.sql", time.Unix(), file.name) afero.WriteFile(fs, upFN, []byte("demo up content"), 0666) afero.WriteFile(fs, dnFN, []byte("demo down content"), 0666) afero.WriteFile(fs, fmt.Sprintf("random_file_%d", index), []byte("rand"), 0666) } table := []struct { name string from string to string result []struct { up string down string } }{ { name: "returns first file", from: "2019-09-20T12:00:05Z", to: "2020-09-20T12:01:05Z", result: []struct { up string down string }{{up: "mig_1600603205_up.sql", down: "mig_1600603205_down.sql"}}, }, { name: "returns all files", from: "2019-09-20T12:00:05Z", to: "2021-09-20T12:01:05Z", result: []struct { up string down string }{ {up: "mig_1600603205_up.sql", down: "mig_1600603205_down.sql"}, {up: "mig_1600606805_demoname_up.sql", down: "mig_1600606805_demoname_down.sql"}, {up: "mig_1600610405_testname_up.sql", down: "mig_1600610405_testname_down.sql"}, {up: "mig_1600614005_up.sql", down: "mig_1600614005_down.sql"}, }, }, { name: "returns first two files", from: "2020-01-20T12:01:05Z", to: "2020-09-20T13:00:05Z", result: []struct { up string down string }{ {up: "mig_1600603205_up.sql", down: "mig_1600603205_down.sql"}, {up: "mig_1600606805_demoname_up.sql", down: "mig_1600606805_demoname_down.sql"}, }, }, { name: "returns last 2 files", from: "2020-09-20T13:00:05Z", to: "2021-09-20T12:01:05Z", result: []struct { up string down string }{ {up: "mig_1600610405_testname_up.sql", down: "mig_1600610405_testname_down.sql"}, {up: "mig_1600614005_up.sql", down: "mig_1600614005_down.sql"}, }, }, } for _, val := range table { t.Run(val.name, func(t *testing.T) { fsystem := &ImplFilesystem{Fs: fs} t1, _ := time.Parse(time.RFC3339, val.from) t2, _ := time.Parse(time.RFC3339, val.to) res, err := fsystem.GetFileTimestamps(t1, t2) if err != nil { t.Fail() } for k, v := range res { if v.Up != val.result[k].up { t.Fail() } if v.Down != val.result[k].down { t.Fail() } } }) } }
explode_data.jsonl/81670
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 1410 }
[ 2830, 3393, 1949, 1703, 20812, 82, 1155, 353, 8840, 836, 8, 341, 53584, 1669, 264, 802, 78, 7121, 18816, 2227, 48300, 2822, 74075, 1669, 3056, 1235, 341, 197, 21957, 914, 198, 197, 11609, 914, 198, 197, 59403, 197, 197, 515, 298, 2195...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
5
func Test_metricsForwarder_resetSecretsCache(t *testing.T) { mf := &metricsForwarder{ creds: sync.Map{}, } mf.resetSecretsCache(map[string]string{ "k": "v", }) v, found := mf.creds.Load("k") assert.True(t, found) assert.Equal(t, "v", v) mf.resetSecretsCache(map[string]string{ "kk": "vv", "kkk": "vvv", }) _, found = mf.creds.Load("k") assert.False(t, found) v, found = mf.creds.Load("kk") assert.True(t, found) assert.Equal(t, "vv", v) v, found = mf.creds.Load("kkk") assert.True(t, found) assert.Equal(t, "vvv", v) }
explode_data.jsonl/8876
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 268 }
[ 2830, 3393, 37686, 25925, 261, 18983, 19773, 82, 8233, 1155, 353, 8840, 836, 8, 341, 2109, 69, 1669, 609, 43262, 25925, 261, 515, 197, 197, 85734, 25, 12811, 10104, 38837, 197, 630, 2109, 69, 13857, 19773, 82, 8233, 9147, 14032, 30953, ...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
1
func TestUnmarshalNoError(t *testing.T) { cases := []struct { name, hex string expected Packet }{{ "AARP", "0001809b0604" + // Ethernet-LLAP bridging "0003" + // Probe "080007b4b1ce" + "00ff005f" + // This is (tentatively) my address "000000000000" + "00ff005f", // Anyone out there using that address? Packet{ EthernetLLAPBridging, Body{ Opcode: ProbeOp, Src: AddrPair{ Hardware: ethernet.Addr{0x08, 0x00, 0x07, 0xb4, 0xb1, 0xce}, Proto: ddp.Addr{Network: 65280, Node: 95}, }, Dst: AddrPair{ Hardware: ethernet.Addr{}, Proto: ddp.Addr{Network: 65280, Node: 95}, }, }, }, }} for _, c := range cases { t.Run(c.name, func(t *testing.T) { assert := assert.New(t) p := Packet{} if assert.NoError(Unmarshal(unhex(c.hex), &p)) { assert.Equal(c.expected, p) } }) } }
explode_data.jsonl/6229
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 435 }
[ 2830, 3393, 1806, 27121, 2753, 1454, 1155, 353, 8840, 836, 8, 341, 1444, 2264, 1669, 3056, 1235, 341, 197, 11609, 11, 12371, 914, 198, 197, 42400, 220, 28889, 198, 197, 15170, 515, 197, 197, 29133, 42793, 756, 197, 197, 1, 15, 15, 1...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
2
func TestClientWillMarkConnectionsAsAliveWhenAllAreDead(t *testing.T) { client, err := NewClient(SetURL("http://127.0.0.1:9201"), SetSniff(false), SetHealthcheck(false), SetMaxRetries(0)) if err != nil { t.Fatal(err) } // We should have a connection. if len(client.conns) != 1 { t.Fatalf("expected 1 node, got: %d (%v)", len(client.conns), client.conns) } // Make a request, so that the connections is marked as dead. client.Flush().Do(context.TODO()) // The connection should now be marked as dead. if i, found := findConn("http://127.0.0.1:9201", client.conns...); !found { t.Fatalf("expected connection to %q to be found", "http://127.0.0.1:9201") } else { if conn := client.conns[i]; !conn.IsDead() { t.Fatalf("expected connection to be dead, got: %v", conn) } } // Now send another request and the connection should be marked as alive again. client.Flush().Do(context.TODO()) if i, found := findConn("http://127.0.0.1:9201", client.conns...); !found { t.Fatalf("expected connection to %q to be found", "http://127.0.0.1:9201") } else { if conn := client.conns[i]; conn.IsDead() { t.Fatalf("expected connection to be alive, got: %v", conn) } } }
explode_data.jsonl/37999
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 455 }
[ 2830, 3393, 2959, 9945, 8949, 54751, 2121, 32637, 4498, 2403, 11526, 28320, 1155, 353, 8840, 836, 8, 341, 25291, 11, 1848, 1669, 1532, 2959, 52474, 3144, 445, 1254, 1110, 16, 17, 22, 13, 15, 13, 15, 13, 16, 25, 24, 17, 15, 16, 446...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
7
func TestAllocations(t *testing.T) { noAlloc(t, 100, func(j int) { var i interface{} var v Value // We can uncomment this when compiler escape analysis // is good enough to see that the integer assigned to i // does not escape and therefore need not be allocated. // // i = 42 + j // v = ValueOf(i) // if int(v.Int()) != 42+j { // panic("wrong int") // } i = func(j int) int { return j } v = ValueOf(i) if v.Interface().(func(int) int)(j) != j { panic("wrong result") } }) }
explode_data.jsonl/29574
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 203 }
[ 2830, 3393, 25154, 804, 1155, 353, 8840, 836, 8, 341, 72104, 25154, 1155, 11, 220, 16, 15, 15, 11, 2915, 3325, 526, 8, 341, 197, 2405, 600, 3749, 16094, 197, 2405, 348, 5162, 271, 197, 197, 322, 1205, 646, 62073, 419, 979, 19415, ...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
1
func Test_changeQueryAge(t *testing.T) { testcases := []struct { answer string want string nowant string }{ {answer: "00:01:00", want: "00:01:00", nowant: "00:00:00"}, {answer: "", want: "00:00:00", nowant: "00:01:00"}, } config := newConfig() config.view = config.views["activity"] wg := sync.WaitGroup{} for i, tc := range testcases { t.Run(fmt.Sprintln(i), func(t *testing.T) { wg.Add(1) go func() { v := <-config.viewCh assert.Contains(t, v.Query, tc.answer) assert.NotContains(t, v.Query, tc.nowant) wg.Done() }() got := changeQueryAge(tc.answer, config) assert.Equal(t, "Activity age: set "+tc.want, got) }) wg.Wait() } t.Run("invalid time", func(t *testing.T) { config.queryOptions.QueryAgeThresh = "01:02:03" got := changeQueryAge("invalid", config) assert.Equal(t, "Activity age: do nothing, invalid input", got) assert.Equal(t, "01:02:03", config.queryOptions.QueryAgeThresh) // age should be the same as before calling changeQueryAge. }) t.Run("break formatting", func(t *testing.T) { config.queryOptions.QueryAgeThresh = "11:12:13" config.view.QueryTmpl = "{{" // break query template leads breaking query formatting got := changeQueryAge("00:00:00", config) assert.Equal(t, "Activity age: do nothing, template: query:1: unclosed action", got) assert.Equal(t, "11:12:13", config.queryOptions.QueryAgeThresh) // age should be the same as before calling changeQueryAge. }) close(config.viewCh) }
explode_data.jsonl/69233
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 591 }
[ 2830, 3393, 15947, 2859, 16749, 1155, 353, 8840, 836, 8, 341, 18185, 23910, 1669, 3056, 1235, 341, 197, 72570, 914, 198, 197, 50780, 256, 914, 198, 197, 80922, 517, 914, 198, 197, 59403, 197, 197, 90, 9217, 25, 330, 15, 15, 25, 15, ...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
1
func TestConfigParseEnvironment(t *testing.T) { assert := assert.New(t) os.Setenv("COOKIE_NAME", "env_cookie_name") os.Setenv("PROVIDERS_GOOGLE_CLIENT_ID", "env_client_id") os.Setenv("COOKIE_DOMAIN", "test1.com,example.org") os.Setenv("DOMAIN", "test2.com,example.org") os.Setenv("WHITELIST", "test3.com,example.org") c, err := NewConfig([]string{}) assert.Nil(err) assert.Equal("env_cookie_name", c.CookieName, "variable should be read from environment") assert.Equal("env_client_id", c.Providers.Google.ClientID, "namespace variable should be read from environment") assert.Equal([]CookieDomain{ *NewCookieDomain("test1.com"), *NewCookieDomain("example.org"), }, c.CookieDomains, "array variable should be read from environment COOKIE_DOMAIN") assert.Equal(CommaSeparatedList{"test2.com", "example.org"}, c.Domains, "array variable should be read from environment DOMAIN") assert.Equal(CommaSeparatedList{"test3.com", "example.org"}, c.Whitelist, "array variable should be read from environment WHITELIST") os.Unsetenv("COOKIE_NAME") os.Unsetenv("PROVIDERS_GOOGLE_CLIENT_ID") os.Unsetenv("COOKIE_DOMAIN") os.Unsetenv("DOMAIN") os.Unsetenv("WHITELIST") }
explode_data.jsonl/33758
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 443 }
[ 2830, 3393, 2648, 14463, 12723, 1155, 353, 8840, 836, 8, 341, 6948, 1669, 2060, 7121, 1155, 340, 25078, 4202, 3160, 445, 44796, 4708, 497, 330, 3160, 38663, 1269, 1138, 25078, 4202, 3160, 445, 9117, 7483, 4321, 39622, 47350, 22521, 3450, ...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
1
func TestSendOSSignal(t *testing.T) { defer goroutinechecker.New(t)() logger, logBuf := testlogger.NewTestLogger(t, log.Warn) sig := syscall.SIGHUP sigC := make(chan signal.Signal) err := signal.BeginSignalHandling(logger, nil, signal.SIGHUP, func(s signal.Signal) { sigC <- s }) require.NoError(t, err, "unexpected error from starting signal handling") defer signal.StopSignalHandling() err = syscall.Kill(os.Getpid(), sig) require.NoError(t, err, "unexpected error from sending signal") select { case s := <-sigC: assert.Equal(t, signal.SIGHUP, s, "mismatched signal") case <-time.After(2 * time.Second): t.Fatal("timeout waiting for signal handler to be called") } assert.Empty(t, string(logBuf.BytesCopy()), "unexpected log output") }
explode_data.jsonl/73531
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 288 }
[ 2830, 3393, 11505, 46, 1220, 25719, 1155, 353, 8840, 836, 8, 341, 16867, 45198, 14159, 69955, 7121, 1155, 8, 2822, 17060, 11, 1487, 15064, 1669, 1273, 9786, 7121, 2271, 7395, 1155, 11, 1487, 68465, 692, 84841, 1669, 49345, 808, 16768, 3...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
1
func TestIsTemporary(t *testing.T) { err := serrors.New("not temp") assert.False(t, serrors.IsTemporary(err)) wrappedErr := serrors.WrapStr("temp", &testToTempErr{msg: "to", temporary: true}) assert.True(t, serrors.IsTemporary(wrappedErr)) noTempWrappingTemp := serrors.WrapStr("notemp", &testToTempErr{ msg: "non temp wraps temp", temporary: false, cause: &testToTempErr{msg: "temp", temporary: true}, }) assert.False(t, serrors.IsTemporary(noTempWrappingTemp)) }
explode_data.jsonl/4290
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 198 }
[ 2830, 3393, 3872, 59362, 1155, 353, 8840, 836, 8, 341, 9859, 1669, 274, 7650, 7121, 445, 1921, 2730, 1138, 6948, 50757, 1155, 11, 274, 7650, 4506, 59362, 3964, 1171, 6692, 56289, 7747, 1669, 274, 7650, 38968, 2580, 445, 3888, 756, 197, ...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
1
func TestSyncQueue(t *testing.T) { var q syncQueue var closed int32 var flusherWG sync.WaitGroup flusherWG.Add(1) go func() { defer flusherWG.Done() for { if atomic.LoadInt32(&closed) == 1 { return } head, tail := q.load() q.pop(head, tail, nil) } }() var commitMu sync.Mutex var doneWG sync.WaitGroup for i := 0; i < SyncConcurrency; i++ { doneWG.Add(1) go func(i int) { defer doneWG.Done() for j := 0; j < 1000; j++ { wg := &sync.WaitGroup{} wg.Add(1) // syncQueue is a single-producer, single-consumer queue. We need to // provide mutual exclusion on the producer side. commitMu.Lock() q.push(wg, new(error)) commitMu.Unlock() wg.Wait() } }(i) } doneWG.Wait() atomic.StoreInt32(&closed, 1) flusherWG.Wait() }
explode_data.jsonl/58753
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 371 }
[ 2830, 3393, 12154, 7554, 1155, 353, 8840, 836, 8, 341, 2405, 2804, 12811, 7554, 198, 2405, 7877, 526, 18, 17, 271, 2405, 18198, 261, 84916, 12811, 28384, 2808, 198, 1166, 34604, 261, 84916, 1904, 7, 16, 340, 30680, 2915, 368, 341, 197...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
3
func Test_UpdateManager_UpdateNotCollected(t *testing.T) { model := NewMemoryModel() manager := newUpdateManager(model) objectid := NewObjectID("kind", "value") stopVisit := model.StopVisits().New() stopVisit.SetObjectID(objectid) stopVisit.collected = true stopVisit.Save() manager.Update(NewNotCollectedUpdateEvent(objectid)) updatedStopVisit, _ := model.StopVisits().Find(stopVisit.Id()) if updatedStopVisit.DepartureStatus != STOP_VISIT_DEPARTURE_DEPARTED { t.Errorf("StopVisit DepartureStatus should be updated") } if updatedStopVisit.ArrivalStatus != STOP_VISIT_ARRIVAL_CANCELLED { t.Errorf("StopVisit ArrivalStatus should be updated") } if updatedStopVisit.collected { t.Errorf("StopVisit Collected should be updated") } }
explode_data.jsonl/49838
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 250 }
[ 2830, 3393, 47393, 2043, 47393, 2623, 6127, 2209, 1155, 353, 8840, 836, 8, 341, 19727, 1669, 1532, 10642, 1712, 741, 92272, 1669, 501, 4289, 2043, 7635, 692, 35798, 307, 1669, 1532, 1190, 915, 445, 15314, 497, 330, 957, 1138, 62644, 262...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
4
func TestVariadic(t *testing.T) { var b bytes.Buffer V := ValueOf b.Reset() V(fmt.Fprintf).Call([]Value{V(&b), V("%s, %d world"), V("hello"), V(42)}) if b.String() != "hello, 42 world" { t.Errorf("after Fprintf Call: %q != %q", b.String(), "hello 42 world") } b.Reset() V(fmt.Fprintf).CallSlice([]Value{V(&b), V("%s, %d world"), V([]interface{}{"hello", 42})}) if b.String() != "hello, 42 world" { t.Errorf("after Fprintf CallSlice: %q != %q", b.String(), "hello 42 world") } }
explode_data.jsonl/29580
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 214 }
[ 2830, 3393, 56135, 36214, 1155, 353, 8840, 836, 8, 341, 2405, 293, 5820, 22622, 198, 17446, 1669, 5162, 2124, 271, 2233, 36660, 741, 17446, 28197, 59559, 568, 7220, 10556, 1130, 90, 53, 2099, 65, 701, 647, 4430, 82, 11, 1018, 67, 1879...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
3
func TestReadASN1IntegerSigned(t *testing.T) { testData64 := []struct { in []byte out int64 }{ {[]byte{2, 3, 128, 0, 0}, -0x800000}, {[]byte{2, 2, 255, 0}, -256}, {[]byte{2, 2, 255, 127}, -129}, {[]byte{2, 1, 128}, -128}, {[]byte{2, 1, 255}, -1}, {[]byte{2, 1, 0}, 0}, {[]byte{2, 1, 1}, 1}, {[]byte{2, 1, 2}, 2}, {[]byte{2, 1, 127}, 127}, {[]byte{2, 2, 0, 128}, 128}, {[]byte{2, 2, 1, 0}, 256}, {[]byte{2, 4, 0, 128, 0, 0}, 0x800000}, } for i, test := range testData64 { in := String(test.in) var out int64 ok := in.ReadASN1Integer(&out) if !ok || out != test.out { t.Errorf("#%d: in.ReadASN1Integer() = %v, want true; out = %d, want %d", i, ok, out, test.out) } } // Repeat the same cases, reading into a big.Int. t.Run("big.Int", func(t *testing.T) { for i, test := range testData64 { in := String(test.in) var out big.Int ok := in.ReadASN1Integer(&out) if !ok || out.Int64() != test.out { t.Errorf("#%d: in.ReadASN1Integer() = %v, want true; out = %d, want %d", i, ok, out.Int64(), test.out) } } }) // Repeat with the implicit-tagging functions t.Run("WithTag", func(t *testing.T) { for i, test := range testData64 { tag := asn1.Tag((i * 3) % 32).ContextSpecific() testData := make([]byte, len(test.in)) copy(testData, test.in) // Alter the tag of the test case. testData[0] = uint8(tag) in := String(testData) var out int64 ok := in.ReadASN1Int64WithTag(&out, tag) if !ok || out != test.out { t.Errorf("#%d: in.ReadASN1Int64WithTag() = %v, want true; out = %d, want %d", i, ok, out, test.out) } var b Builder b.AddASN1Int64WithTag(test.out, tag) result, err := b.Bytes() if err != nil { t.Errorf("#%d: AddASN1Int64WithTag failed: %s", i, err) continue } if !bytes.Equal(result, testData) { t.Errorf("#%d: AddASN1Int64WithTag: got %x, want %x", i, result, testData) } } }) }
explode_data.jsonl/16724
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 924 }
[ 2830, 3393, 4418, 68134, 16, 3486, 49312, 1155, 353, 8840, 836, 8, 341, 18185, 1043, 21, 19, 1669, 3056, 1235, 341, 197, 17430, 220, 3056, 3782, 198, 197, 13967, 526, 21, 19, 198, 197, 59403, 197, 197, 90, 1294, 3782, 90, 17, 11, ...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
4