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 TestHistoryRemoveAPI(t *testing.T) { node := nodeWithMemoryEngine() ruleConfig := rule.DefaultConfig ruleContainer := rule.NewContainer(ruleConfig) api := NewExecutor(node, ruleContainer, "test") resp := api.HistoryRemove(context.Background(), &HistoryRemoveRequest{}) require.Equal(t, ErrorBadRequest, resp.Error) resp = api.HistoryRemove(context.Background(), &HistoryRemoveRequest{Channel: "test"}) require.Equal(t, ErrorNotAvailable, resp.Error) config := ruleContainer.Config() config.HistorySize = 1 config.HistoryLifetime = 1 _ = ruleContainer.Reload(config) resp = api.HistoryRemove(context.Background(), &HistoryRemoveRequest{Channel: "test"}) require.Nil(t, resp.Error) }
explode_data.jsonl/48462
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 215 }
[ 2830, 3393, 13424, 13021, 7082, 1155, 353, 8840, 836, 8, 341, 20831, 1669, 2436, 2354, 10642, 4571, 741, 7000, 1111, 2648, 1669, 5912, 13275, 2648, 198, 7000, 1111, 4502, 1669, 5912, 7121, 4502, 34944, 2648, 692, 54299, 1669, 1532, 25255,...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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 TestGroupByClauseRestore(t *testing.T) { testCases := []NodeRestoreTestCase{ {"GROUP BY a,b desc", "GROUP BY `a`,`b` DESC"}, {"GROUP BY 1 desc,b", "GROUP BY 1 DESC,`b`"}, } extractNodeFunc := func(node Node) Node { return node.(*SelectStmt).GroupBy } runNodeRestoreTest(t, testCases, "select * from t %s", extractNodeFunc) }
explode_data.jsonl/27579
{ "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, 2808, 1359, 28482, 56284, 1155, 353, 8840, 836, 8, 341, 18185, 37302, 1669, 3056, 1955, 56284, 16458, 515, 197, 197, 4913, 41480, 7710, 264, 8402, 6560, 497, 330, 41480, 7710, 1565, 64, 40181, 65, 63, 16089, 7115, 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 TestUnmarshalServerBoundHandshake(t *testing.T) { tt := []struct { packet mc.Packet unmarshalledPacket mc.ServerBoundHandshake }{ { packet: mc.Packet{ ID: 0x00, // ProtoVer. | Server Address |Serv. Port | Nxt State Data: []byte{0xC2, 0x04, 0x0B, 0x73, 0x70, 0x6F, 0x6F, 0x6B, 0x2E, 0x73, 0x70, 0x61, 0x63, 0x65, 0x63, 0xDD, 0x01}, }, unmarshalledPacket: mc.ServerBoundHandshake{ ProtocolVersion: 578, ServerAddress: "spook.space", ServerPort: 25565, NextState: mc.StatusState, }, }, { packet: mc.Packet{ ID: 0x00, // ProtoVer. | Server Address |Serv. Port | Nxt State Data: []byte{0xC2, 0x04, 0x0B, 0x65, 0x78, 0x61, 0x6D, 0x70, 0x6C, 0x65, 0x2E, 0x63, 0x6F, 0x6D, 0x05, 0x39, 0x01}, }, unmarshalledPacket: mc.ServerBoundHandshake{ ProtocolVersion: 578, ServerAddress: "example.com", ServerPort: 1337, NextState: mc.StatusState, }, }, } for _, tc := range tt { actual, err := mc.UnmarshalServerBoundHandshake(tc.packet) if err != nil { t.Error(err) } expected := tc.unmarshalledPacket if actual.ProtocolVersion != expected.ProtocolVersion || actual.ServerAddress != expected.ServerAddress || actual.ServerPort != expected.ServerPort || actual.NextState != expected.NextState { t.Errorf("got: %v, want: %v", actual, tc.unmarshalledPacket) } } }
explode_data.jsonl/45000
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 815 }
[ 2830, 3393, 1806, 27121, 5475, 19568, 2314, 29661, 1155, 353, 8840, 836, 8, 341, 3244, 83, 1669, 3056, 1235, 341, 197, 68802, 1797, 19223, 93971, 198, 197, 20479, 36239, 4736, 16679, 19223, 22997, 19568, 2314, 29661, 198, 197, 59403, 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...
7
func TestNodes_Len(t *testing.T) { nodes := Nodes{ &Node{val: []byte("1")}, &Node{val: []byte("2")}, &Node{val: []byte("3")}, &Node{val: []byte("4")}, &Node{val: []byte("5")}, } exp := len(nodes) if act := nodes.Len(); exp != act { t.Errorf("expected Len to be %d, got %d", exp, act) } }
explode_data.jsonl/57986
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 145 }
[ 2830, 3393, 12288, 2351, 268, 1155, 353, 8840, 836, 8, 341, 79756, 1669, 52501, 515, 197, 197, 5, 1955, 90, 831, 25, 3056, 3782, 445, 16, 79583, 197, 197, 5, 1955, 90, 831, 25, 3056, 3782, 445, 17, 79583, 197, 197, 5, 1955, 90, ...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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 TestCompositeLit4(t *testing.T) { gopClTest(t, ` type Result struct { A int } func foo() *Result { return {A: 1} } `, `package main type Result struct { A int } func foo() *Result { return &Result{A: 1} } `) }
explode_data.jsonl/73631
{ "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, 41685, 68954, 19, 1155, 353, 8840, 836, 8, 341, 3174, 453, 5066, 2271, 1155, 11, 22074, 1313, 5714, 2036, 341, 22985, 526, 198, 630, 2830, 15229, 368, 353, 2077, 341, 853, 314, 32, 25, 220, 16, 532, 532, 7808, 1565, 1722...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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 TestFuzz(t *testing.T) { t.Parallel() for _, data := range []string{ ` type H b[A] type b[L] { m b[u:L] l b[z:L] m b[V:L] m b[0:L] H b[o:L] } `, ` type p b[L] type b[L]{ e b[3:L] e b[2:L] e b[1[L]] k b[H] k b[Q] }`, "d~^gB̉`i\u007f?\xb0.", "da[", "define\x98define(define\x98define\x98define\x98define\x98define)define\tdefin", "resource g[g]", `t[ l t ]`, `t()D[0] type D[e]l`, "E", "#", ` type p b[L] type b[L] { e b[L[L]] }`, ` p() b[len] type b[b] b `, ` p() b[len[opt]] type b[b] b `, } { Fuzz([]byte(data)[:len(data):len(data)]) } }
explode_data.jsonl/53122
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 377 }
[ 2830, 3393, 37, 8889, 1155, 353, 8840, 836, 8, 341, 3244, 41288, 7957, 741, 2023, 8358, 821, 1669, 2088, 3056, 917, 515, 197, 197, 3989, 1313, 472, 293, 22519, 921, 1313, 293, 49415, 60, 341, 2109, 293, 21335, 69233, 921, 8810, 293, ...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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 TestDeleteValidatorBurn(t *testing.T) { stakedValidator := getStakedValidator() var emptyCoins sdk.Dec type args struct { amount sdk.Dec validator types.Validator } type expected struct { amount sdk.Dec found bool message string } tests := []struct { name string panics bool args expected }{ { name: "deletes validator burn", panics: false, args: args{amount: sdk.NewDec(10), validator: stakedValidator}, expected: expected{amount: emptyCoins, found: false}, }, } for _, test := range tests { t.Run(test.name, func(t *testing.T) { context, _, keeper := createTestInput(t, true) keeper.setValidatorBurn(context, test.args.amount, test.args.validator.Address) keeper.deleteValidatorBurn(context, test.args.validator.Address) coins, found := keeper.getValidatorBurn(context, test.args.validator.Address) assert.Equal(t, test.expected.found, found, "found does not match expected") assert.True(t, coins.IsNil(), "received coins are not the expected coins") }) } }
explode_data.jsonl/9976
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 398 }
[ 2830, 3393, 6435, 14256, 66213, 1155, 353, 8840, 836, 8, 341, 18388, 7741, 14256, 1669, 633, 623, 7741, 14256, 741, 2405, 4287, 69602, 45402, 22442, 271, 13158, 2827, 2036, 341, 197, 197, 6045, 262, 45402, 22442, 198, 197, 197, 16112, 4...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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 TestPublishWithoutSourceId(t *testing.T) { payload := buildDefaultTestPayloadWithoutSourceId() body, statusCode := performPublishRequest(t, publishServer.URL, payload) assertExpectedError(t, body, statusCode, http.StatusBadRequest, api.FieldSourceId+"/"+api.HeaderSourceId, api.ErrorTypeValidationViolation) }
explode_data.jsonl/74411
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 96 }
[ 2830, 3393, 50145, 26040, 3608, 764, 1155, 353, 8840, 836, 8, 341, 76272, 1669, 1936, 3675, 2271, 29683, 26040, 3608, 764, 741, 35402, 11, 35532, 1669, 2736, 50145, 1900, 1155, 11, 3415, 5475, 20893, 11, 7729, 340, 6948, 18896, 1454, 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...
1
func TestTSCall(t *testing.T) { expectPrintedTS(t, "foo()", "foo();\n") expectPrintedTS(t, "foo<number>()", "foo();\n") expectPrintedTS(t, "foo<number, boolean>()", "foo();\n") }
explode_data.jsonl/82328
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 82 }
[ 2830, 3393, 51, 3540, 541, 1155, 353, 8840, 836, 8, 341, 24952, 8994, 291, 9951, 1155, 11, 330, 7975, 50514, 330, 7975, 2129, 59, 77, 1138, 24952, 8994, 291, 9951, 1155, 11, 330, 7975, 39982, 13555, 497, 330, 7975, 2129, 59, 77, 113...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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 TestJiraIntegration(t *testing.T) { testutil.ConfigureIntegrationTest(t, testConfig, "TestJiraIntegration") Convey("With a JIRA rest interface that makes a valid request", t, func() { jira := JiraHandler{client: http.DefaultClient, opts: *testConfig.Jira.Export()} Convey("the request for a ticket should return a valid ticket response", func() { ticket, err := jira.GetJIRATicket("BF-1") So(err, ShouldBeNil) So(ticket.Key, ShouldEqual, "BF-1") So(ticket.Fields.Project.Name, ShouldEqual, "Build Failures") }) }) }
explode_data.jsonl/23587
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 197 }
[ 2830, 3393, 41, 8832, 52464, 1155, 353, 8840, 836, 8, 341, 18185, 1314, 78281, 52464, 2271, 1155, 11, 1273, 2648, 11, 330, 2271, 41, 8832, 52464, 1138, 93070, 5617, 445, 2354, 264, 619, 60556, 2732, 3749, 429, 3643, 264, 2697, 1681, 4...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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 TestStaticSource(t *testing.T) { certPEM, keyPEM := makePEM("localhost", time.Minute) cert, err := tls.X509KeyPair(certPEM, keyPEM) if err != nil { t.Fatalf("X509KeyPair: got %s want nil", err) } testSource(t, StaticSource{cert}, makeCertPool(certPEM), 0) }
explode_data.jsonl/24942
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 112 }
[ 2830, 3393, 11690, 3608, 1155, 353, 8840, 836, 8, 341, 1444, 529, 1740, 44, 11, 1376, 1740, 44, 1669, 1281, 1740, 44, 445, 8301, 497, 882, 75770, 340, 1444, 529, 11, 1848, 1669, 55026, 4338, 20, 15, 24, 1592, 12443, 87793, 1740, 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...
2
func TestOverrideDefaultRateLimitConfig(t *testing.T) { var rateLimitReadQPS float32 = 3.0 rateLimitReadBuckets := 10 var rateLimitWriteQPS float32 = 6.0 rateLimitWriteBuckets := 20 defaultConfigWithRateLimits := &CloudProviderRateLimitConfig{ RateLimitConfig: azclients.RateLimitConfig{ CloudProviderRateLimitBucket: rateLimitReadBuckets, CloudProviderRateLimitBucketWrite: rateLimitWriteBuckets, CloudProviderRateLimitQPS: rateLimitReadQPS, CloudProviderRateLimitQPSWrite: rateLimitWriteQPS, }, } configWithRateLimits := &CloudProviderRateLimitConfig{ RateLimitConfig: azclients.RateLimitConfig{ CloudProviderRateLimit: true, CloudProviderRateLimitBucket: 0, CloudProviderRateLimitBucketWrite: 0, CloudProviderRateLimitQPS: 0, CloudProviderRateLimitQPSWrite: 0, }, } newconfig := overrideDefaultRateLimitConfig(&defaultConfigWithRateLimits.RateLimitConfig, &configWithRateLimits.RateLimitConfig) assert.Equal(t, defaultConfigWithRateLimits.CloudProviderRateLimitQPS, newconfig.CloudProviderRateLimitQPS) assert.Equal(t, defaultConfigWithRateLimits.CloudProviderRateLimitBucket, newconfig.CloudProviderRateLimitBucket) assert.Equal(t, defaultConfigWithRateLimits.CloudProviderRateLimitQPSWrite, newconfig.CloudProviderRateLimitQPSWrite) assert.Equal(t, defaultConfigWithRateLimits.CloudProviderRateLimitBucketWrite, newconfig.CloudProviderRateLimitBucketWrite) falseCloudProviderRateLimit := &CloudProviderRateLimitConfig{ RateLimitConfig: azclients.RateLimitConfig{ CloudProviderRateLimit: false, }, } newconfig = overrideDefaultRateLimitConfig(&defaultConfigWithRateLimits.RateLimitConfig, &falseCloudProviderRateLimit.RateLimitConfig) assert.Equal(t, &falseCloudProviderRateLimit.RateLimitConfig, newconfig) }
explode_data.jsonl/12804
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 593 }
[ 2830, 3393, 2177, 3675, 11564, 16527, 2648, 1155, 353, 8840, 836, 8, 341, 2405, 4379, 16527, 4418, 48, 5012, 2224, 18, 17, 284, 220, 18, 13, 15, 198, 7000, 349, 16527, 4418, 33, 38551, 1669, 220, 16, 15, 198, 2405, 4379, 16527, 7985...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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 TestRangeLookupWithOpenTransaction(t *testing.T) { defer leaktest.AfterTest(t)() s, _ := startNoSplitMergeServer(t) defer s.Stopper().Stop(context.TODO()) // Create an intent on the meta1 record by writing directly to the // engine. key := testutils.MakeKey(keys.Meta1Prefix, roachpb.KeyMax) now := s.Clock().Now() txn := roachpb.MakeTransaction("txn", roachpb.Key("foobar"), 0, now, 0) if err := engine.MVCCPutProto( context.Background(), s.(*server.TestServer).Engines()[0], nil, key, now, &txn, &roachpb.RangeDescriptor{}); err != nil { t.Fatal(err) } // Create a new DistSender and client.DB so that the Get below is guaranteed // to not hit in the range descriptor cache forcing a RangeLookup operation. ambient := log.AmbientContext{Tracer: s.ClusterSettings().Tracer} ds := kv.NewDistSender( kv.DistSenderConfig{ AmbientCtx: ambient, Clock: s.Clock(), RPCContext: s.RPCContext(), NodeDialer: nodedialer.New(s.RPCContext(), gossip.AddressResolver(s.(*server.TestServer).Gossip())), }, s.(*server.TestServer).Gossip(), ) tsf := kv.NewTxnCoordSenderFactory( kv.TxnCoordSenderFactoryConfig{ AmbientCtx: ambient, Clock: s.Clock(), Stopper: s.Stopper(), }, ds, ) db := client.NewDB(ambient, tsf, s.Clock()) // Now, with an intent pending, attempt (asynchronously) to read // from an arbitrary key. This will cause the distributed sender to // do a range lookup, which will encounter the intent. We're // verifying here that the range lookup doesn't fail with a write // intent error. If it did, it would go into a deadloop attempting // to push the transaction, which in turn requires another range // lookup, etc, ad nauseam. if _, err := db.Get(context.TODO(), "a"); err != nil { t.Fatal(err) } }
explode_data.jsonl/36450
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 658 }
[ 2830, 3393, 6046, 34247, 2354, 5002, 8070, 1155, 353, 8840, 836, 8, 341, 16867, 23352, 1944, 36892, 2271, 1155, 8, 741, 1903, 11, 716, 1669, 1191, 2753, 20193, 52096, 5475, 1155, 340, 16867, 274, 7758, 18487, 1005, 10674, 5378, 90988, 1...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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 TestReversiAnz9(t *testing.T) { r := NewReversiAnz() r.SetPointCnt(1) if r.GetPointCnt() != 1 { t.Errorf("NG") } }
explode_data.jsonl/23032
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 66 }
[ 2830, 3393, 693, 3004, 72, 2082, 89, 24, 1155, 353, 8840, 836, 8, 341, 7000, 1669, 1532, 693, 3004, 72, 2082, 89, 741, 7000, 4202, 2609, 33747, 7, 16, 340, 743, 435, 2234, 2609, 33747, 368, 961, 220, 16, 341, 197, 3244, 13080, 445...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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 TestWorkspace_DeleteWorkspaceFile(t *testing.T) { testCases := map[string]struct { copilotDir string fs func() afero.Fs }{ ".workspace should be deleted": { copilotDir: "copilot", fs: func() afero.Fs { fs := afero.NewMemMapFs() fs.MkdirAll("/copilot", 0755) fs.Create("/copilot/.workspace") return fs }, }, } for name, tc := range testCases { t.Run(name, func(t *testing.T) { // GIVEN fs := tc.fs() ws := &Workspace{ copilotDir: tc.copilotDir, fsUtils: &afero.Afero{ Fs: fs, }, } ws.fsUtils.MkdirAll("copilot", 0755) ws.fsUtils.Create(tc.copilotDir + "/" + ".workspace") // WHEN err := ws.DeleteWorkspaceFile() // THEN require.NoError(t, err) // There should be no more .workspace file under the copilot/ directory. path := filepath.Join(tc.copilotDir, "/.workspace") _, existErr := fs.Stat(path) expectedErr := &os.PathError{ Op: "open", Path: path, Err: os.ErrNotExist, } require.EqualError(t, existErr, expectedErr.Error()) }) } }
explode_data.jsonl/30122
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 508 }
[ 2830, 3393, 45981, 57418, 45981, 1703, 1155, 353, 8840, 836, 8, 341, 18185, 37302, 1669, 2415, 14032, 60, 1235, 341, 197, 1444, 453, 23958, 6184, 914, 198, 197, 53584, 260, 2915, 368, 264, 802, 78, 991, 82, 198, 197, 59403, 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 TestReconcileOnStoppedPipelineRunWithCompletedTask(t *testing.T) { // TestReconcileOnStoppedPipelineRunWithCompletedTask runs "Reconcile" on a PipelineRun that has been gracefully stopped // and waits for all running tasks to be completed, before stopping the run. // It verifies that reconcile is successful, final tasks run, the pipeline status updated and events generated. prs := []*v1beta1.PipelineRun{{ ObjectMeta: baseObjectMeta("test-pipeline-run-stopped", "foo"), Spec: v1beta1.PipelineRunSpec{ PipelineRef: &v1beta1.PipelineRef{Name: "test-pipeline"}, ServiceAccountName: "test-sa", Status: v1beta1.PipelineRunSpecStatusStoppedRunFinally, }, Status: v1beta1.PipelineRunStatus{ PipelineRunStatusFields: v1beta1.PipelineRunStatusFields{ StartTime: &metav1.Time{Time: now}, TaskRuns: map[string]*v1beta1.PipelineRunTaskRunStatus{ "test-pipeline-run-stopped-hello-world": { PipelineTaskName: "hello-world-1", Status: &v1beta1.TaskRunStatus{}, }, }, }, }, }} ps := []*v1beta1.Pipeline{{ ObjectMeta: baseObjectMeta("test-pipeline", "foo"), Spec: v1beta1.PipelineSpec{ Tasks: []v1beta1.PipelineTask{ { Name: "hello-world-1", TaskRef: &v1beta1.TaskRef{ Name: "hello-world", }, }, { Name: "hello-world-2", TaskRef: &v1beta1.TaskRef{ Name: "hello-world", }, RunAfter: []string{"hello-world-1"}, }, }, }, }} ts := []*v1beta1.Task{simpleHelloWorldTask} trs := []*v1beta1.TaskRun{ getTaskRun( t, "test-pipeline-run-stopped-hello-world", "test-pipeline-run-stopped", "test-pipeline", "hello-world", corev1.ConditionTrue, ), } cms := []*corev1.ConfigMap{withEnabledAlphaAPIFields(newFeatureFlagsConfigMap())} d := test.Data{ PipelineRuns: prs, Pipelines: ps, Tasks: ts, TaskRuns: trs, ConfigMaps: cms, } prt := newPipelineRunTest(d, t) defer prt.Cancel() wantEvents := []string{ "Warning Failed PipelineRun \"test-pipeline-run-stopped\" was cancelled", } reconciledRun, clients := prt.reconcileRun("foo", "test-pipeline-run-stopped", wantEvents, false) if reconciledRun.Status.CompletionTime == nil { t.Errorf("Expected a CompletionTime on invalid PipelineRun but was nil") } // This PipelineRun should still be complete and false, and the status should reflect that if !reconciledRun.Status.GetCondition(apis.ConditionSucceeded).IsFalse() { t.Errorf("Expected PipelineRun status to be complete and false, but was %v", reconciledRun.Status.GetCondition(apis.ConditionSucceeded)) } if len(reconciledRun.Status.TaskRuns) != 1 { t.Fatalf("Expected 1 TaskRun but got %d", len(reconciledRun.Status.TaskRuns)) } expectedSkippedTasks := []v1beta1.SkippedTask{{ Name: "hello-world-2", }} if d := cmp.Diff(expectedSkippedTasks, reconciledRun.Status.SkippedTasks); d != "" { t.Fatalf("Didn't get the expected list of skipped tasks. Diff: %s", diff.PrintWantGot(d)) } actions := clients.Pipeline.Actions() patchCount := 0 for _, action := range actions { if _, ok := action.(ktesting.PatchAction); ok { patchCount++ } } if patchCount != 0 { t.Errorf("Expected no patch action, but was %v", patchCount) } }
explode_data.jsonl/27293
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 1361 }
[ 2830, 3393, 693, 40446, 457, 1925, 59803, 34656, 51918, 22724, 6262, 1155, 353, 8840, 836, 8, 341, 197, 322, 3393, 693, 40446, 457, 1925, 59803, 34656, 51918, 22724, 6262, 8473, 330, 693, 40446, 457, 1, 389, 264, 40907, 6727, 429, 702, ...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
8
func TestLogResponse(t *testing.T) { cases := []struct { Body *bytes.Buffer ExpectBody []byte ReadBody bool LogLevel aws.LogLevelType }{ { Body: bytes.NewBuffer([]byte("body content")), ExpectBody: []byte("body content"), }, { Body: bytes.NewBuffer([]byte("body content")), LogLevel: aws.LogDebug, ExpectBody: []byte("body content"), }, { Body: bytes.NewBuffer([]byte("body content")), LogLevel: aws.LogDebugWithHTTPBody, ReadBody: true, ExpectBody: []byte("body content"), }, } for i, c := range cases { var logW bytes.Buffer req := request.New( aws.Config{ Credentials: credentials.AnonymousCredentials, Logger: &bufLogger{w: &logW}, LogLevel: aws.LogLevel(c.LogLevel), }, metadata.ClientInfo{ Endpoint: "https://mock-service.mock-region.amazonaws.com", }, testHandlers(), nil, &request.Operation{ Name: "APIName", HTTPMethod: "POST", HTTPPath: "/", }, struct{}{}, nil, ) req.HTTPResponse = &http.Response{ StatusCode: 200, Status: "OK", Header: http.Header{ "ABC": []string{"123"}, }, Body: ioutil.NopCloser(c.Body), } logResponse(req) req.Handlers.Unmarshal.Run(req) if c.ReadBody { if e, a := len(c.ExpectBody), c.Body.Len(); e != a { t.Errorf("%d, expect original body not to of been read", i) } } if logW.Len() == 0 { t.Errorf("%d, expect HTTP Response headers to be logged", i) } b, err := ioutil.ReadAll(req.HTTPResponse.Body) if err != nil { t.Fatalf("%d, expect to read SDK request Body", i) } if e, a := c.ExpectBody, b; !bytes.Equal(e, a) { t.Errorf("%d, expect %v body, got %v", i, e, a) } } }
explode_data.jsonl/41773
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 820 }
[ 2830, 3393, 2201, 2582, 1155, 353, 8840, 836, 8, 341, 1444, 2264, 1669, 3056, 1235, 341, 197, 197, 5444, 981, 353, 9651, 22622, 198, 197, 35911, 5444, 3056, 3782, 198, 197, 96043, 5444, 256, 1807, 198, 197, 24201, 4449, 256, 31521, 52...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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 TestGetKnownUsers(t *testing.T) { th := Setup(t) defer th.TearDown() t1, err := th.App.CreateTeam(th.Context, &model.Team{ DisplayName: "dn_" + model.NewId(), Name: GenerateTestTeamName(), Email: th.GenerateTestEmail(), Type: model.TeamOpen, }) require.Nil(t, err, "failed to create team") t2, err := th.App.CreateTeam(th.Context, &model.Team{ DisplayName: "dn_" + model.NewId(), Name: GenerateTestTeamName(), Email: th.GenerateTestEmail(), Type: model.TeamOpen, }) require.Nil(t, err, "failed to create team") t3, err := th.App.CreateTeam(th.Context, &model.Team{ DisplayName: "dn_" + model.NewId(), Name: GenerateTestTeamName(), Email: th.GenerateTestEmail(), Type: model.TeamOpen, }) require.Nil(t, err, "failed to create team") c1, err := th.App.CreateChannel(th.Context, &model.Channel{ DisplayName: "dn_" + model.NewId(), Name: "name_" + model.NewId(), Type: model.ChannelTypeOpen, TeamId: t1.Id, CreatorId: model.NewId(), }, false) require.Nil(t, err, "failed to create channel") c2, err := th.App.CreateChannel(th.Context, &model.Channel{ DisplayName: "dn_" + model.NewId(), Name: "name_" + model.NewId(), Type: model.ChannelTypeOpen, TeamId: t2.Id, CreatorId: model.NewId(), }, false) require.Nil(t, err, "failed to create channel") c3, err := th.App.CreateChannel(th.Context, &model.Channel{ DisplayName: "dn_" + model.NewId(), Name: "name_" + model.NewId(), Type: model.ChannelTypeOpen, TeamId: t3.Id, CreatorId: model.NewId(), }, false) require.Nil(t, err, "failed to create channel") u1 := th.CreateUser() defer th.App.PermanentDeleteUser(th.Context, u1) u2 := th.CreateUser() defer th.App.PermanentDeleteUser(th.Context, u2) u3 := th.CreateUser() defer th.App.PermanentDeleteUser(th.Context, u3) u4 := th.CreateUser() defer th.App.PermanentDeleteUser(th.Context, u4) th.LinkUserToTeam(u1, t1) th.LinkUserToTeam(u1, t2) th.LinkUserToTeam(u2, t1) th.LinkUserToTeam(u3, t2) th.LinkUserToTeam(u4, t3) th.App.AddUserToChannel(u1, c1, false) th.App.AddUserToChannel(u1, c2, false) th.App.AddUserToChannel(u2, c1, false) th.App.AddUserToChannel(u3, c2, false) th.App.AddUserToChannel(u4, c3, false) t.Run("get know users sharing no channels", func(t *testing.T) { _, _, _ = th.Client.Login(u4.Email, u4.Password) userIds, _, err := th.Client.GetKnownUsers() require.NoError(t, err) assert.Empty(t, userIds) }) t.Run("get know users sharing one channel", func(t *testing.T) { _, _, _ = th.Client.Login(u3.Email, u3.Password) userIds, _, err := th.Client.GetKnownUsers() require.NoError(t, err) assert.Len(t, userIds, 1) assert.Equal(t, userIds[0], u1.Id) }) t.Run("get know users sharing multiple channels", func(t *testing.T) { _, _, _ = th.Client.Login(u1.Email, u1.Password) userIds, _, err := th.Client.GetKnownUsers() require.NoError(t, err) assert.Len(t, userIds, 2) assert.ElementsMatch(t, userIds, []string{u2.Id, u3.Id}) }) }
explode_data.jsonl/47564
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 1387 }
[ 2830, 3393, 1949, 48206, 7137, 1155, 353, 8840, 836, 8, 341, 70479, 1669, 18626, 1155, 340, 16867, 270, 836, 682, 4454, 2822, 3244, 16, 11, 1848, 1669, 270, 5105, 7251, 14597, 24365, 9328, 11, 609, 2528, 65842, 515, 197, 197, 26456, 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 TestCacheKVStore(t *testing.T) { mem := dbadapter.Store{DB: dbm.NewMemDB()} st := cachekv.NewStore(mem) require.Empty(t, st.Get(keyFmt(1)), "Expected `key1` to be empty") // put something in mem and in cache mem.Set(keyFmt(1), valFmt(1)) st.Set(keyFmt(1), valFmt(1)) require.Equal(t, valFmt(1), st.Get(keyFmt(1))) // update it in cache, shoudn't change mem st.Set(keyFmt(1), valFmt(2)) require.Equal(t, valFmt(2), st.Get(keyFmt(1))) require.Equal(t, valFmt(1), mem.Get(keyFmt(1))) // write it. should change mem st.Write() require.Equal(t, valFmt(2), mem.Get(keyFmt(1))) require.Equal(t, valFmt(2), st.Get(keyFmt(1))) // more writes and checks st.Write() st.Write() require.Equal(t, valFmt(2), mem.Get(keyFmt(1))) require.Equal(t, valFmt(2), st.Get(keyFmt(1))) // make a new one, check it st = cachekv.NewStore(mem) require.Equal(t, valFmt(2), st.Get(keyFmt(1))) // make a new one and delete - should not be removed from mem st = cachekv.NewStore(mem) st.Delete(keyFmt(1)) require.Empty(t, st.Get(keyFmt(1))) require.Equal(t, mem.Get(keyFmt(1)), valFmt(2)) // Write. should now be removed from both st.Write() require.Empty(t, st.Get(keyFmt(1)), "Expected `key1` to be empty") require.Empty(t, mem.Get(keyFmt(1)), "Expected `key1` to be empty") }
explode_data.jsonl/6647
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 572 }
[ 2830, 3393, 8233, 82707, 6093, 1155, 353, 8840, 836, 8, 341, 14145, 1669, 2927, 19731, 38047, 90, 3506, 25, 2927, 76, 7121, 18816, 3506, 23509, 18388, 1669, 60287, 1225, 85, 7121, 6093, 39908, 692, 17957, 11180, 1155, 11, 357, 2234, 485...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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 TestLRUCapacityEntries(t *testing.T) { require := require.New(t) const cacheSize = 5 var ( nrEvictCallbacks int evictedKey, evictedValue interface{} ) cache, err := New( Capacity(uint64(cacheSize), false), OnEvict(func(k, v interface{}) { evictedKey, evictedValue = k, v nrEvictCallbacks++ }), ) require.NoError(err, "New") entries := makeEntries(cacheSize) for _, ent := range entries { err = cache.Put(ent.key, ent) require.NoError(err, "Put") } for _, ent := range entries { rawEnt, ok := cache.Peek(ent.key) require.True(ok, "Peek - present") require.Equal(ent, rawEnt, "Peek - entry") } keys := cache.Keys() for i, ent := range entries { rawEnt, ok := cache.Get(ent.key) require.True(ok, "Get - present") require.Equal(ent, rawEnt, "Get - entry") require.Equal(keys[i], ent.key, "Keys - key") } // Access the entries in random order. order := rand.New(rand.NewSource(23)).Perm(len(entries)) for _, v := range order { rawEnt, ok := cache.Get(entries[v].key) require.True(ok, "Get - random order") require.Equal(entries[v], rawEnt, "Get - random order") } // Insert an entry to force eviction. order = append(order, len(entries)) evictEnt := makeEntry("evictionTest") entries = append(entries, evictEnt) err = cache.Put(evictEnt.key, evictEnt) require.NoError(err, "Put - will evict") require.Equal(1, nrEvictCallbacks, "Put - OnEvict called") require.Equal(entries[order[0]].key, evictedKey, "Evict - key") require.Equal(entries[order[0]], evictedValue, "Evict - value") for i, k := range cache.Keys() { entIdx := order[i+1] require.Equal(entries[entIdx].key, k) } // Update a entry. updateVal := "Yes I know this mixes value types." err = cache.Put(entries[order[1]].key, updateVal) require.NoError(err, "Put - update") v, ok := cache.Get(entries[order[1]].key) require.True(ok, "Get - update") require.Equal(updateVal, v, "Get - update") require.Equal(uint64(cacheSize), cache.Size(), "Size") // Clear cache. cache.Clear() _, ok = cache.Peek(entries[0].key) require.False(ok, "Peek - expected entry to not exist after removal") require.Empty(cache.Keys(), "Empty keys") require.EqualValues(0, cache.Size(), "Empty size") }
explode_data.jsonl/69518
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 877 }
[ 2830, 3393, 20117, 5459, 391, 4018, 24533, 1155, 353, 8840, 836, 8, 341, 17957, 1669, 1373, 7121, 1155, 692, 4777, 6500, 1695, 284, 220, 20, 271, 2405, 2399, 197, 9038, 81, 34112, 849, 44461, 260, 526, 198, 197, 74837, 12770, 1592, 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...
1
func TestCaptiveAfterClose(t *testing.T) { metaChan := make(chan metaResult, 100) for i := 64; i <= 66; i++ { meta := buildLedgerCloseMeta(testLedgerHeader{sequence: uint32(i)}) metaChan <- metaResult{ LedgerCloseMeta: &meta, } } mockRunner := &stellarCoreRunnerMock{} ctx, cancel := context.WithCancel(context.Background()) mockRunner.On("catchup", uint32(65), uint32(66)).Return(nil) mockRunner.On("getMetaPipe").Return((<-chan metaResult)(metaChan)) mockRunner.On("context").Return(ctx) mockRunner.On("close").Return(nil).Once() mockArchive := &historyarchive.MockArchive{} mockArchive. On("GetRootHAS"). Return(historyarchive.HistoryArchiveState{ CurrentLedger: uint32(200), }, nil) captiveBackend := CaptiveStellarCore{ archive: mockArchive, stellarCoreRunnerFactory: func(_ stellarCoreRunnerMode) (stellarCoreRunnerInterface, error) { return mockRunner, nil }, checkpointManager: historyarchive.NewCheckpointManager(64), cancel: cancel, } boundedRange := BoundedRange(65, 66) err := captiveBackend.PrepareRange(ctx, boundedRange) assert.NoError(t, err) assert.NoError(t, captiveBackend.Close()) assert.True(t, captiveBackend.closed) _, err = captiveBackend.GetLedger(ctx, boundedRange.to) assert.EqualError(t, err, "stellar-core is no longer usable") var prepared bool prepared, err = captiveBackend.IsPrepared(ctx, boundedRange) assert.False(t, prepared) assert.NoError(t, err) _, err = captiveBackend.GetLatestLedgerSequence(ctx) assert.EqualError(t, err, "stellar-core is no longer usable") mockArchive.AssertExpectations(t) mockRunner.AssertExpectations(t) }
explode_data.jsonl/7330
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 597 }
[ 2830, 3393, 34, 27781, 6025, 7925, 1155, 353, 8840, 836, 8, 341, 84004, 46019, 1669, 1281, 35190, 8823, 2077, 11, 220, 16, 15, 15, 692, 2023, 600, 1669, 220, 21, 19, 26, 600, 2651, 220, 21, 21, 26, 600, 1027, 341, 197, 84004, 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, 1...
1
func TestGetApplicationDetail(t *testing.T) { tests := map[string]struct { engine chaosTypes.EngineInfo isErr bool }{ "Test Positive-1": { engine: chaosTypes.EngineInfo{ Instance: &v1alpha1.ChaosEngine{ ObjectMeta: metav1.ObjectMeta{ Name: "test-monitor", Namespace: "test", }, Spec: v1alpha1.ChaosEngineSpec{ Appinfo: v1alpha1.ApplicationParams{ Applabel: "key=value", }, }, }, }, isErr: false, }, "Test Negative": { engine: chaosTypes.EngineInfo{ Instance: nil, }, isErr: true, }, } for name, mock := range tests { t.Run(name, func(t *testing.T) { err := getApplicationDetail(&mock.engine) if mock.isErr && err == nil { t.Fatalf("Test %q failed: expected error not to be nil", name) } if !mock.isErr && err != nil { fmt.Println(err) t.Fatalf("Test %q failed: expected error to be nil", name) } }) } }
explode_data.jsonl/32124
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 437 }
[ 2830, 3393, 1949, 4988, 10649, 1155, 353, 8840, 836, 8, 341, 78216, 1669, 2415, 14032, 60, 1235, 341, 197, 80118, 26915, 4173, 54424, 1731, 198, 197, 19907, 7747, 220, 1807, 198, 197, 59403, 197, 197, 1, 2271, 43903, 12, 16, 788, 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...
5
func TestErrNotInMainChain(t *testing.T) { errStr := "no block at height 1 exists" err := error(errNotInMainChain(errStr)) // Ensure the stringized output for the error is as expected. if err.Error() != errStr { t.Fatalf("errNotInMainChain retuned unexpected error string - got %q, want %q", err.Error(), errStr) } // Ensure error is detected as the correct type. if !isNotInMainChainErr(err) { t.Fatalf("isNotInMainChainErr did not detect as expected type") } err = errors.New("something else") if isNotInMainChainErr(err) { t.Fatalf("isNotInMainChainErr detected incorrect type") } }
explode_data.jsonl/37661
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 208 }
[ 2830, 3393, 7747, 2623, 641, 6202, 18837, 1155, 353, 8840, 836, 8, 341, 9859, 2580, 1669, 330, 2152, 2504, 518, 2608, 220, 16, 6724, 698, 9859, 1669, 1465, 3964, 2623, 641, 6202, 18837, 3964, 2580, 4390, 197, 322, 29279, 279, 914, 150...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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 TestHex2Int(t *testing.T) { assert.EqualValues(t, 0, Hex2Int("0x0")) assert.EqualValues(t, 1, Hex2Int("0x01")) assert.EqualValues(t, 100, Hex2Int("64")) assert.EqualValues(t, 25600, Hex2Int("6400")) var maxUint64 uint64 maxUint64 = math.MaxUint64 assert.EqualValues(t, Hex2Int("ffffffffffffffff"), maxUint64) assert.EqualValues(t, Hex2Int("ffffffff"), math.MaxUint32) assert.EqualValues(t, 0, Hex2Int("-100")) assert.EqualValues(t, 0, Hex2Int("invalid number")) }
explode_data.jsonl/31334
{ "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, 20335, 17, 1072, 1155, 353, 8840, 836, 8, 341, 6948, 12808, 6227, 1155, 11, 220, 15, 11, 27228, 17, 1072, 445, 15, 87, 15, 5455, 6948, 12808, 6227, 1155, 11, 220, 16, 11, 27228, 17, 1072, 445, 15, 87, 15, 16, 5455, 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...
1
func TestUnitTokenAccessorRenewSessionContention(t *testing.T) { accessor := getSimpleTokenAccessor() oldToken := "test" accessor.SetTokens(oldToken, "master", 123) var counter int32 = 0 expectedToken := "new token" expectedMaster := "new master" expectedSession := int64(321) renewSessionDummy := func(_ context.Context, sr *snowflakeRestful, _ time.Duration) error { accessor.SetTokens(expectedToken, expectedMaster, expectedSession) atomic.AddInt32(&counter, 1) return nil } sr := &snowflakeRestful{ FuncRenewSession: renewSessionDummy, TokenAccessor: accessor, } var renewalsStart sync.WaitGroup var renewalsDone sync.WaitGroup var renewalError error numRoutines := 50 for i := 0; i < numRoutines; i++ { renewalsDone.Add(1) renewalsStart.Add(1) go func() { // wait for all goroutines to have been created before proceeding to race against each other renewalsStart.Wait() err := sr.renewExpiredSessionToken(context.Background(), time.Hour, oldToken) if err != nil { renewalError = err } renewalsDone.Done() }() } // unlock all of the waiting goroutines simultaneously renewalsStart.Add(-numRoutines) // wait for all competing goroutines to finish calling renew expired session token renewalsDone.Wait() if renewalError != nil { t.Fatalf("failed to renew session, error %v", renewalError) } newToken, newMaster, newSession := accessor.GetTokens() if newToken != expectedToken { t.Fatalf("token %v does not match expected %v", newToken, expectedToken) } if newMaster != expectedMaster { t.Fatalf("master token %v does not match expected %v", newMaster, expectedMaster) } if newSession != expectedSession { t.Fatalf("session %v does not match expected %v", newSession, expectedSession) } // only the first renewal will go through and FuncRenewSession should be called exactly once if counter != 1 { t.Fatalf("renew expired session was called more than once: %v", counter) } }
explode_data.jsonl/44743
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 649 }
[ 2830, 3393, 4562, 3323, 29889, 34625, 365, 5283, 2762, 290, 1155, 353, 8840, 836, 8, 341, 197, 5211, 269, 1669, 633, 16374, 3323, 29889, 741, 61828, 3323, 1669, 330, 1944, 698, 197, 5211, 269, 4202, 29300, 21972, 3323, 11, 330, 13629, ...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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 TestOurConfig(t *testing.T) { cm, example := ConfigMapsFromTestFile(t, ConfigName) if _, err := NewConfigFromConfigMap(cm); err != nil { t.Error("NewConfigFromConfigMap(actual) =", err) } if got, err := NewConfigFromConfigMap(example); err != nil { t.Error("NewConfigFromConfigMap(example) =", err) } else if want := defaultConfig(); !cmp.Equal(got, want) { t.Errorf("ExampleConfig does not match default config: (-want,+got):\n%s", cmp.Diff(want, got)) } }
explode_data.jsonl/58823
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 170 }
[ 2830, 3393, 7981, 2648, 1155, 353, 8840, 836, 8, 341, 98316, 11, 3110, 1669, 5532, 36562, 3830, 2271, 1703, 1155, 11, 5532, 675, 692, 743, 8358, 1848, 1669, 1532, 2648, 3830, 2648, 2227, 51126, 1215, 1848, 961, 2092, 341, 197, 3244, 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...
4
func TestListenNotifySelfNotification(t *testing.T) { t.Parallel() conn := mustConnectString(t, os.Getenv("PGX_TEST_DATABASE")) defer closeConn(t, conn) skipCockroachDB(t, conn, "Server does not support LISTEN / NOTIFY (https://github.com/cockroachdb/cockroach/issues/41522)") mustExec(t, conn, "listen self") // Notify self and WaitForNotification immediately mustExec(t, conn, "notify self") ctx, cancel := context.WithTimeout(context.Background(), time.Second) defer cancel() notification, err := conn.WaitForNotification(ctx) require.NoError(t, err) assert.Equal(t, "self", notification.Channel) // Notify self and do something else before WaitForNotification mustExec(t, conn, "notify self") rows, _ := conn.Query(context.Background(), "select 1") rows.Close() if rows.Err() != nil { t.Fatalf("Unexpected error on Query: %v", rows.Err()) } ctx, cncl := context.WithTimeout(context.Background(), time.Second) defer cncl() notification, err = conn.WaitForNotification(ctx) require.NoError(t, err) assert.Equal(t, "self", notification.Channel) }
explode_data.jsonl/40018
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 374 }
[ 2830, 3393, 38714, 28962, 12092, 11196, 1155, 353, 8840, 836, 8, 341, 3244, 41288, 7957, 2822, 32917, 1669, 1969, 14611, 703, 1155, 11, 2643, 64883, 445, 11383, 55, 11641, 45510, 5455, 16867, 3265, 9701, 1155, 11, 4534, 692, 1903, 13389, ...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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 TestSnapshotExtract(t *testing.T) { if runtime.GOOS == "windows" { t.Skip("Depends on unimplemented containerd bind-mount support on Windows") } t.Parallel() ctx := namespaces.WithNamespace(context.Background(), "buildkit-test") tmpdir, err := ioutil.TempDir("", "cachemanager") require.NoError(t, err) defer os.RemoveAll(tmpdir) snapshotter, err := native.NewSnapshotter(filepath.Join(tmpdir, "snapshots")) require.NoError(t, err) co, cleanup, err := newCacheManager(ctx, cmOpt{ snapshotter: snapshotter, snapshotterName: "native", }) require.NoError(t, err) defer cleanup() cm := co.manager b, desc, err := mapToBlob(map[string]string{"foo": "bar"}, true) require.NoError(t, err) err = content.WriteBlob(ctx, co.cs, "ref1", bytes.NewBuffer(b), desc) require.NoError(t, err) snap, err := cm.GetByBlob(ctx, desc, nil) require.NoError(t, err) require.Equal(t, false, !snap.(*immutableRef).getBlobOnly()) b2, desc2, err := mapToBlob(map[string]string{"foo": "bar123"}, true) require.NoError(t, err) err = content.WriteBlob(ctx, co.cs, "ref1", bytes.NewBuffer(b2), desc2) require.NoError(t, err) snap2, err := cm.GetByBlob(ctx, desc2, snap) require.NoError(t, err) size, err := snap2.(*immutableRef).size(ctx) require.NoError(t, err) require.Equal(t, int64(len(b2)), size) require.Equal(t, false, !snap2.(*immutableRef).getBlobOnly()) dirs, err := ioutil.ReadDir(filepath.Join(tmpdir, "snapshots/snapshots")) require.NoError(t, err) require.Equal(t, 0, len(dirs)) checkNumBlobs(ctx, t, co.cs, 2) err = snap2.Extract(ctx, nil) require.NoError(t, err) require.Equal(t, true, !snap.(*immutableRef).getBlobOnly()) require.Equal(t, true, !snap2.(*immutableRef).getBlobOnly()) dirs, err = ioutil.ReadDir(filepath.Join(tmpdir, "snapshots/snapshots")) require.NoError(t, err) require.Equal(t, 2, len(dirs)) buf := pruneResultBuffer() err = cm.Prune(ctx, buf.C, client.PruneInfo{}) buf.close() require.NoError(t, err) checkDiskUsage(ctx, t, cm, 2, 0) require.Equal(t, len(buf.all), 0) dirs, err = ioutil.ReadDir(filepath.Join(tmpdir, "snapshots/snapshots")) require.NoError(t, err) require.Equal(t, 2, len(dirs)) checkNumBlobs(ctx, t, co.cs, 2) id := snap.ID() err = snap.Release(context.TODO()) require.NoError(t, err) buf = pruneResultBuffer() err = cm.Prune(ctx, buf.C, client.PruneInfo{}) buf.close() require.NoError(t, err) checkDiskUsage(ctx, t, cm, 2, 0) dirs, err = ioutil.ReadDir(filepath.Join(tmpdir, "snapshots/snapshots")) require.NoError(t, err) require.Equal(t, 2, len(dirs)) snap, err = cm.Get(ctx, id) require.NoError(t, err) checkDiskUsage(ctx, t, cm, 2, 0) err = snap2.Release(context.TODO()) require.NoError(t, err) checkDiskUsage(ctx, t, cm, 1, 1) buf = pruneResultBuffer() err = cm.Prune(ctx, buf.C, client.PruneInfo{}) buf.close() require.NoError(t, err) checkDiskUsage(ctx, t, cm, 1, 0) require.Equal(t, len(buf.all), 1) dirs, err = ioutil.ReadDir(filepath.Join(tmpdir, "snapshots/snapshots")) require.NoError(t, err) require.Equal(t, 1, len(dirs)) checkNumBlobs(ctx, t, co.cs, 1) err = snap.Release(context.TODO()) require.NoError(t, err) buf = pruneResultBuffer() err = cm.Prune(ctx, buf.C, client.PruneInfo{}) buf.close() require.NoError(t, err) checkDiskUsage(ctx, t, cm, 0, 0) dirs, err = ioutil.ReadDir(filepath.Join(tmpdir, "snapshots/snapshots")) require.NoError(t, err) require.Equal(t, 0, len(dirs)) checkNumBlobs(ctx, t, co.cs, 0) }
explode_data.jsonl/3974
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 1457 }
[ 2830, 3393, 15009, 28959, 1155, 353, 8840, 836, 8, 341, 743, 15592, 97574, 3126, 621, 330, 27077, 1, 341, 197, 3244, 57776, 445, 7839, 1412, 389, 650, 54071, 5476, 67, 10719, 59588, 1824, 389, 5515, 1138, 197, 630, 3244, 41288, 7957, ...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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 TestTeamsService_ReviewProjectsByID(t *testing.T) { client, mux, _, teardown := setup() defer teardown() wantAcceptHeaders := []string{mediaTypeProjectsPreview} mux.HandleFunc("/organizations/1/team/1/projects/1", func(w http.ResponseWriter, r *http.Request) { testMethod(t, r, "GET") testHeader(t, r, "Accept", strings.Join(wantAcceptHeaders, ", ")) fmt.Fprint(w, `{"id":1}`) }) ctx := context.Background() project, _, err := client.Teams.ReviewTeamProjectsByID(ctx, 1, 1, 1) if err != nil { t.Errorf("Teams.ReviewTeamProjectsByID returned error: %v", err) } want := &Project{ID: Int64(1)} if !cmp.Equal(project, want) { t.Errorf("Teams.ReviewTeamProjectsByID returned %+v, want %+v", project, want) } const methodName = "ReviewTeamProjectsByID" testBadOptions(t, methodName, func() (err error) { _, _, err = client.Teams.ReviewTeamProjectsByID(ctx, -1, -1, -1) return err }) testNewRequestAndDoFailure(t, methodName, client, func() (*Response, error) { got, resp, err := client.Teams.ReviewTeamProjectsByID(ctx, 1, 1, 1) if got != nil { t.Errorf("testNewRequestAndDoFailure %v = %#v, want nil", methodName, got) } return resp, err }) }
explode_data.jsonl/4547
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 468 }
[ 2830, 3393, 60669, 1860, 62, 19432, 29958, 60572, 1155, 353, 8840, 836, 8, 341, 25291, 11, 59807, 11, 8358, 49304, 1669, 6505, 741, 16867, 49304, 2822, 50780, 16646, 10574, 1669, 3056, 917, 90, 7399, 929, 29958, 24625, 532, 2109, 2200, ...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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 TestOneofParsing(t *testing.T) { const in = `name:"Shrek"` m := new(Communique) want := &Communique{Union: &Communique_Name{"Shrek"}} if err := UnmarshalText(in, m); err != nil { t.Fatal(err) } if !Equal(m, want) { t.Errorf("\n got %v\nwant %v", m, want) } const inOverwrite = `name:"Shrek" number:42` m = new(Communique) testErr := "line 1.13: field 'number' would overwrite already parsed oneof 'Union'" if err := UnmarshalText(inOverwrite, m); err == nil { t.Errorf("TestOneofParsing: Didn't get expected error: %v", testErr) } else if err.Error() != testErr { t.Errorf("TestOneofParsing: Incorrect error.\nHave: %v\nWant: %v", err.Error(), testErr) } }
explode_data.jsonl/9706
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 290 }
[ 2830, 3393, 3966, 1055, 68839, 1155, 353, 8840, 836, 8, 341, 4777, 304, 284, 1565, 606, 2974, 2016, 41861, 8805, 2109, 1669, 501, 7, 17977, 9587, 340, 50780, 1669, 609, 17977, 9587, 90, 32658, 25, 609, 17977, 9587, 19015, 4913, 2016, ...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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 TestRemoveoldest(t *testing.T) { k1, k2, k3 := "key1", "key2", "key3" v1, v2, v3 := "v1", "v2", "v3" cap := len(k1 + k2 + v1 + v2) lru := New(int64(cap), nil) lru.Add(k1, String(v1)) lru.Add(k2, String(v2)) lru.Add(k3, String(v3)) if _, ok := lru.Get("key1"); ok || lru.Len() != 2 { t.Fatalf("removeoldest key1 failed") } }
explode_data.jsonl/16544
{ "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, 13021, 337, 4979, 1155, 353, 8840, 836, 8, 220, 341, 16463, 16, 11, 595, 17, 11, 595, 18, 1669, 330, 792, 16, 497, 330, 792, 17, 497, 330, 792, 18, 698, 5195, 16, 11, 348, 17, 11, 348, 18, 1669, 330, 85, 16, 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...
3
func Test_JsonInputSchemaMappingProperties_WhenSerializedToJson_DeserializesAsEqual(t *testing.T) { t.Parallel() parameters := gopter.DefaultTestParameters() parameters.MaxSize = 10 properties := gopter.NewProperties(parameters) properties.Property( "Round trip of JsonInputSchemaMappingProperties via JSON returns original", prop.ForAll(RunJSONSerializationTestForJsonInputSchemaMappingProperties, JsonInputSchemaMappingPropertiesGenerator())) properties.TestingRun(t, gopter.NewFormatedReporter(true, 240, os.Stdout)) }
explode_data.jsonl/39625
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 170 }
[ 2830, 3393, 62, 5014, 2505, 8632, 6807, 7903, 62, 4498, 77521, 78967, 98054, 2848, 4756, 2121, 2993, 1155, 353, 8840, 836, 8, 341, 3244, 41288, 7957, 741, 67543, 1669, 728, 73137, 13275, 2271, 9706, 741, 67543, 14535, 1695, 284, 220, 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...
1
func TestHgGetFileByCommit(t *testing.T) { assert := assert.New(t) repo, client := helpers.CreateHgRepo(t, "hg-repo") defer helpers.CleanupHgRepo(t, client) commitID := helpers.SeedHgRepo(t, repo, client) result, err := repo.GetFileByCommit(commitID, "README") assert.Nil(err) fileContent := helpers.GetRepoFiles()["README"] assert.Equal(fileContent, result[:], "Expected file contents to match.") }
explode_data.jsonl/57186
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 158 }
[ 2830, 3393, 39, 70, 1949, 1703, 1359, 33441, 1155, 353, 8840, 836, 8, 341, 6948, 1669, 2060, 7121, 1155, 692, 17200, 5368, 11, 2943, 1669, 30187, 7251, 39, 70, 25243, 1155, 11, 330, 66602, 5504, 5368, 1138, 16867, 30187, 727, 60639, 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 TestIsMultiSigContractGood(t *testing.T) { prog := make([]byte, 71) prog[0] = byte(PUSH2) prog[1] = byte(PUSHBYTES33) prog[35] = byte(PUSHBYTES33) prog[69] = byte(PUSH2) prog[70] = byte(CHECKMULTISIG) assert.Equal(t, true, IsMultiSigContract(prog)) assert.Equal(t, true, IsStandardContract(prog)) }
explode_data.jsonl/40587
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 146 }
[ 2830, 3393, 3872, 20358, 47246, 14067, 15216, 1155, 353, 8840, 836, 8, 341, 197, 32992, 1669, 1281, 10556, 3782, 11, 220, 22, 16, 340, 197, 32992, 58, 15, 60, 284, 4922, 5304, 19518, 17, 340, 197, 32992, 58, 16, 60, 284, 4922, 5304,...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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 TestStatusUpdatesWithoutReplicasChange(t *testing.T) { // Setup a fake server to listen for requests, and run the rc manager in steady state fakeHandler := utiltesting.FakeHandler{ StatusCode: 200, ResponseBody: "", } testServer := httptest.NewServer(&fakeHandler) // TODO: Uncomment when fix #19254 // defer testServer.Close() c := clientset.NewForConfigOrDie(&restclient.Config{Host: testServer.URL, ContentConfig: restclient.ContentConfig{GroupVersion: testapi.Default.GroupVersion()}}) manager := NewReplicationManager(c, controller.NoResyncPeriodFunc, BurstReplicas, 0) manager.podStoreSynced = alwaysReady // Steady state for the replication controller, no Status.Replicas updates expected activePods := 5 rc := newReplicationController(activePods) manager.rcStore.Store.Add(rc) rc.Status = api.ReplicationControllerStatus{Replicas: activePods} newPodList(manager.podStore.Store, activePods, api.PodRunning, rc, "pod") fakePodControl := controller.FakePodControl{} manager.podControl = &fakePodControl manager.syncReplicationController(getKey(rc, t)) validateSyncReplication(t, &fakePodControl, 0, 0) if fakeHandler.RequestReceived != nil { t.Errorf("Unexpected update when pods and rcs are in a steady state") } // This response body is just so we don't err out decoding the http response, all // we care about is the request body sent below. response := runtime.EncodeOrDie(testapi.Default.Codec(), &api.ReplicationController{}) fakeHandler.ResponseBody = response rc.Generation = rc.Generation + 1 manager.syncReplicationController(getKey(rc, t)) rc.Status.ObservedGeneration = rc.Generation updatedRc := runtime.EncodeOrDie(testapi.Default.Codec(), rc) fakeHandler.ValidateRequest(t, testapi.Default.ResourcePath(replicationControllerResourceName(), rc.Namespace, rc.Name)+"/status", "PUT", &updatedRc) }
explode_data.jsonl/37484
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 570 }
[ 2830, 3393, 2522, 37091, 26040, 18327, 52210, 4072, 1155, 353, 8840, 836, 8, 341, 197, 322, 18626, 264, 12418, 3538, 311, 8844, 369, 7388, 11, 323, 1598, 279, 10192, 6645, 304, 24020, 1584, 198, 1166, 726, 3050, 1669, 4094, 8840, 991, ...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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 Test_DocumentProperties_DeleteDocumentProperty(t *testing.T) { config := ReadConfiguration(t) client, ctx := PrepareTest(t, config) remoteDataFolder := remoteBaseTestDataFolder + "/DocumentElements/DocumentProperties" localFile := "Common/test_multi_pages.docx" remoteFileName := "TestDeleteDocumentProperty.docx" UploadNextFileToStorage(t, ctx, client, GetLocalFile(localFile), remoteDataFolder + "/" + remoteFileName) options := map[string]interface{}{ "folder": remoteDataFolder, "destFileName": baseTestOutPath + "/" + remoteFileName, } request := &models.DeleteDocumentPropertyRequest{ Name: ToStringPointer(remoteFileName), PropertyName: ToStringPointer("testProp"), Optionals: options, } _, err := client.WordsApi.DeleteDocumentProperty(ctx, request) if err != nil { t.Error(err) } }
explode_data.jsonl/26159
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 321 }
[ 2830, 3393, 1557, 1452, 7903, 57418, 7524, 3052, 1155, 353, 8840, 836, 8, 341, 262, 2193, 1669, 4457, 7688, 1155, 340, 262, 2943, 11, 5635, 1669, 31166, 2271, 1155, 11, 2193, 340, 262, 8699, 1043, 13682, 1669, 8699, 3978, 83920, 13682, ...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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 TestIssue15920(t *testing.T) { skipSpecialPlatforms(t) // This package only handles gc export data. if runtime.Compiler != "gc" { t.Skipf("gc-built packages not available (compiler = %s)", runtime.Compiler) } // On windows, we have to set the -D option for the compiler to avoid having a drive // letter and an illegal ':' in the import path - just skip it (see also issue #3483). if runtime.GOOS == "windows" { t.Skip("avoid dealing with relative paths/drive letters on windows") } compileAndImportPkg(t, "issue15920") }
explode_data.jsonl/30569
{ "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, 42006, 16, 20, 24, 17, 15, 1155, 353, 8840, 836, 8, 341, 1903, 13389, 20366, 87268, 1155, 692, 197, 322, 1096, 6328, 1172, 13469, 22122, 7485, 821, 624, 743, 15592, 35952, 961, 330, 20669, 1, 341, 197, 3244, 57776, 69, 4...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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 TestIllegalArgmentName(t *testing.T) { const SCRIPT = ` 'use strict'; try { eval("function F(eval) {}"); } catch (e) { var rv = e instanceof SyntaxError } ` testScript(SCRIPT, valueTrue, t) }
explode_data.jsonl/75280
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 86 }
[ 2830, 3393, 33713, 2735, 478, 675, 1155, 353, 8840, 836, 8, 341, 4777, 53679, 284, 22074, 197, 19176, 7304, 2357, 6799, 341, 197, 93413, 445, 1688, 434, 54463, 8, 4687, 797, 197, 92, 2287, 320, 68, 8, 341, 197, 2405, 17570, 284, 384...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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 TestShutdownWorker(t *testing.T) { f := newFixture(t) startTime := metav1.Now() completionTime := metav1.Now() mpiJob := newMPIJob("test", int32Ptr(64), &startTime, &completionTime) f.setUpMPIJob(mpiJob) launcher := newLauncher(mpiJob, "kubectl-delivery") launcher.Status.Succeeded = 1 launcher.Status.Conditions = []batchv1.JobCondition{batchv1.JobCondition{Type: batchv1.JobComplete, Status: corev1.ConditionTrue}} f.setUpLauncher(launcher) worker := newWorker(mpiJob, 8, 8, gpuResourceName, false) f.setUpWorker(worker) expWorker := newWorker(mpiJob, 0, 8, gpuResourceName, false) f.expectUpdateStatefulSetAction(expWorker) mpiJobCopy := mpiJob.DeepCopy() mpiJobCopy.Status.WorkerReplicas = 0 mpiJobCopy.Status.LauncherStatus = kubeflow.LauncherSucceeded setUpMPIJobTimestamp(mpiJobCopy, &startTime, &completionTime) f.expectUpdateMPIJobStatusAction(mpiJobCopy) f.run(getKey(mpiJob, t), gpuResourceName) }
explode_data.jsonl/75014
{ "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, 62004, 21936, 1155, 353, 8840, 836, 8, 341, 1166, 1669, 501, 18930, 1155, 340, 21375, 1462, 1669, 77520, 16, 13244, 741, 32810, 14386, 1462, 1669, 77520, 16, 13244, 2822, 197, 39479, 12245, 1669, 501, 56369, 12245, 445, 1944, ...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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 TestAggregationBuiltinJSONArrayagg(t *testing.T) { store, clean := testkit.CreateMockStore(t) defer clean() tk := testkit.NewTestKit(t, store) tk.MustExec("use test") tk.MustExec("drop table if exists t;") tk.MustExec(`CREATE TABLE t ( a int(11), b varchar(100), c decimal(3,2), d json, e date, f time, g datetime DEFAULT '2012-01-01', h timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP, i char(36), j text(50));`) tk.MustExec(`insert into t values(1, 'ab', 5.5, '{"id": 1}', '2020-01-10', '11:12:13', '2020-01-11', '2020-10-18 00:00:00', 'first', 'json_arrayagg_test');`) result := tk.MustQuery("select a, json_arrayagg(b) from t group by a order by a;") result.Check(testkit.Rows(`1 ["ab"]`)) result = tk.MustQuery("select b, json_arrayagg(c) from t group by b order by b;") result.Check(testkit.Rows(`ab [5.5]`)) result = tk.MustQuery("select e, json_arrayagg(f) from t group by e order by e;") result.Check(testkit.Rows(`2020-01-10 ["11:12:13"]`)) result = tk.MustQuery("select f, json_arrayagg(g) from t group by f order by f;") result.Check(testkit.Rows(`11:12:13 ["2020-01-11 00:00:00"]`)) result = tk.MustQuery("select g, json_arrayagg(h) from t group by g order by g;") result.Check(testkit.Rows(`2020-01-11 00:00:00 ["2020-10-18 00:00:00"]`)) result = tk.MustQuery("select h, json_arrayagg(i) from t group by h order by h;") result.Check(testkit.Rows(`2020-10-18 00:00:00 ["first"]`)) result = tk.MustQuery("select i, json_arrayagg(j) from t group by i order by i;") result.Check(testkit.Rows(`first ["json_arrayagg_test"]`)) result = tk.MustQuery("select json_arrayagg(23) from t group by a order by a;") result.Check(testkit.Rows(`[23]`)) result = tk.MustQuery("select json_arrayagg(null) from t group by a order by a;") result.Check(testkit.Rows(`[null]`)) }
explode_data.jsonl/65449
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 754 }
[ 2830, 3393, 9042, 34442, 33, 25628, 47812, 15718, 1155, 353, 8840, 836, 8, 341, 57279, 11, 4240, 1669, 1273, 8226, 7251, 11571, 6093, 1155, 340, 16867, 4240, 2822, 3244, 74, 1669, 1273, 8226, 7121, 2271, 7695, 1155, 11, 3553, 340, 3244,...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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 TestEnsurePrefixMap(t *testing.T) { t.Parallel() tests := []struct { giveMap map[string]map[string]interface{} givePrefix string want map[string]map[string]interface{} }{ { giveMap: map[string]map[string]interface{}{ "foo/bar": {"a": "b"}, }, givePrefix: "foo", want: map[string]map[string]interface{}{ "foo/bar": {"a": "b"}, }, }, { giveMap: map[string]map[string]interface{}{ "foo/bar": {"a": "b"}, }, givePrefix: "foo/", want: map[string]map[string]interface{}{ "foo/bar": {"a": "b"}, }, }, { giveMap: map[string]map[string]interface{}{ "foo/bar": {"a": "b"}, }, givePrefix: "fo", want: map[string]map[string]interface{}{ "foo/bar": {"a": "b"}, }, }, { giveMap: map[string]map[string]interface{}{ "foo/bar": {"a": "b"}, }, givePrefix: "fooo", want: map[string]map[string]interface{}{ "fooo/foo/bar": {"a": "b"}, }, }, } for _, tt := range tests { tt := tt t.Run(tt.givePrefix, func(t *testing.T) { t.Parallel() EnsurePrefixMap(tt.giveMap, tt.givePrefix) assert.Equal(t, tt.want, tt.giveMap) }) } }
explode_data.jsonl/81333
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 573 }
[ 2830, 3393, 64439, 14335, 2227, 1155, 353, 8840, 836, 8, 341, 3244, 41288, 7957, 2822, 78216, 1669, 3056, 1235, 341, 197, 3174, 533, 2227, 262, 2415, 14032, 60, 2186, 14032, 31344, 16094, 197, 3174, 533, 14335, 914, 198, 197, 50780, 981...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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 TestScenarioResult_FailRate(t *testing.T) { tests := []struct { name string fields fields want float32 }{ {"10%", fields{RequestCount: 10, FailCount: 1}, float32(10)}, {"50%", fields{RequestCount: 10, FailCount: 5}, float32(50)}, {"100%", fields{RequestCount: 10, FailCount: 10}, float32(100)}, } for _, tt := range tests { t.Run(tt.name, func(t *testing.T) { sr := tt.fields.buildScenarioResult() if got := sr.FailRate(); got != tt.want { t.Errorf("FailRate() = %v, want %v", got, tt.want) } }) } }
explode_data.jsonl/49956
{ "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, 54031, 2077, 1400, 604, 11564, 1155, 353, 8840, 836, 8, 341, 78216, 1669, 3056, 1235, 341, 197, 11609, 256, 914, 198, 197, 55276, 5043, 198, 197, 50780, 256, 2224, 18, 17, 198, 197, 59403, 197, 197, 4913, 16, 15, 40192, ...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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 TestCustomReflectQuerier(t *testing.T) { type CapitalizedQuery struct { Text string `json:"text"` } type QueryMsg struct { Capitalized *CapitalizedQuery `json:"capitalized,omitempty"` // There are more queries but we don't use them yet // https://github.com/CosmWasm/cosmwasm/blob/v0.11.0-alpha3/contracts/reflect/src/msg.rs#L18-L28 } type CapitalizedResponse struct { Text string `json:"text"` } cache, cleanup := withCache(t) defer cleanup() checksum := createReflectContract(t, cache) // set up contract gasMeter := NewMockGasMeter(TESTING_GAS_LIMIT) igasMeter := GasMeter(gasMeter) store := NewLookup(gasMeter) api := NewMockAPI() initBalance := types.Coins{types.NewCoin(1234, "ATOM")} querier := DefaultQuerier(MOCK_CONTRACT_ADDR, initBalance) // we need this to handle the custom requests from the reflect contract innerQuerier := querier.(MockQuerier) innerQuerier.Custom = ReflectCustom{} querier = Querier(innerQuerier) // make a valid query to the other address var queryMsg = QueryMsg{ Capitalized: &CapitalizedQuery{ Text: "small Frys :)", }, } query, err := json.Marshal(queryMsg) require.NoError(t, err) env := MockEnvBin(t) data, _, err := Query(cache, checksum, env, query, &igasMeter, store, api, &querier, TESTING_GAS_LIMIT, TESTING_PRINT_DEBUG) require.NoError(t, err) var qres types.QueryResponse err = json.Unmarshal(data, &qres) require.NoError(t, err) require.Equal(t, "", qres.Err) var response CapitalizedResponse err = json.Unmarshal(qres.Ok, &response) require.NoError(t, err) require.Equal(t, "SMALL FRYS :)", response.Text) }
explode_data.jsonl/62567
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 617 }
[ 2830, 3393, 10268, 72789, 2183, 261, 1268, 1155, 353, 8840, 836, 8, 341, 13158, 18374, 1506, 2859, 2036, 341, 197, 49635, 914, 1565, 2236, 2974, 1318, 8805, 197, 630, 13158, 11361, 6611, 2036, 341, 197, 6258, 391, 2174, 1506, 353, 63593...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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 TestTerragruntHookInterpolation(t *testing.T) { t.Parallel() cleanupTerraformFolder(t, TEST_FIXTURE_HOOKS_INTERPOLATIONS_PATH) tmpEnvPath := copyEnvironment(t, TEST_FIXTURE_HOOKS_INTERPOLATIONS_PATH) rootPath := util.JoinPath(tmpEnvPath, TEST_FIXTURE_HOOKS_INTERPOLATIONS_PATH) var ( stdout bytes.Buffer stderr bytes.Buffer ) err := runTerragruntCommand(t, fmt.Sprintf("terragrunt apply -auto-approve --terragrunt-non-interactive --terragrunt-working-dir %s", rootPath), &stdout, &stderr) erroutput := stderr.String() homePath := os.Getenv("HOME") if homePath == "" { homePath = "HelloWorld" } if err != nil { t.Errorf("Did not expect to get error: %s", err.Error()) } assert.Contains(t, erroutput, homePath) }
explode_data.jsonl/10073
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 294 }
[ 2830, 3393, 51402, 68305, 3850, 31679, 3306, 44686, 1155, 353, 8840, 836, 8, 341, 3244, 41288, 7957, 2822, 1444, 60639, 51, 13886, 627, 13682, 1155, 11, 13602, 42635, 41486, 82251, 50, 16732, 49303, 21792, 7944, 340, 20082, 14359, 1820, 1...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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 TestResolveIdentifyImplicitTeamWithIdentifyBadInput(t *testing.T) { tt := newTeamTester(t) defer tt.cleanup() tt.addUser("abc") g := tt.users[0].tc.G cli, err := client.GetIdentifyClient(g) require.NoError(t, err, "failed to get new identifyclient") attachIdentifyUI(t, g, newSimpleIdentifyUI()) _, err = cli.ResolveIdentifyImplicitTeam(context.Background(), keybase1.ResolveIdentifyImplicitTeamArg{ Assertions: "", // blank assertions Suffix: "", IsPublic: false, DoIdentifies: true, Create: true, IdentifyBehavior: keybase1.TLFIdentifyBehavior_DEFAULT_KBFS, }) require.Error(t, err) t.Logf("err: %v", err) _, err = cli.ResolveIdentifyImplicitTeam(context.Background(), keybase1.ResolveIdentifyImplicitTeamArg{ Assertions: tt.users[0].username, Suffix: "bad suffix", IsPublic: false, DoIdentifies: true, Create: true, IdentifyBehavior: keybase1.TLFIdentifyBehavior_DEFAULT_KBFS, }) require.Error(t, err) t.Logf("err: %v", err) _, err = cli.ResolveIdentifyImplicitTeam(context.Background(), keybase1.ResolveIdentifyImplicitTeamArg{ Assertions: "malformed #)*$&#) assertion", Suffix: "", IsPublic: true, DoIdentifies: true, Create: false, IdentifyBehavior: keybase1.TLFIdentifyBehavior_DEFAULT_KBFS, }) require.Error(t, err) t.Logf("err: %v", err) }
explode_data.jsonl/42665
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 638 }
[ 2830, 3393, 56808, 28301, 1437, 59558, 14597, 2354, 28301, 1437, 17082, 2505, 1155, 353, 8840, 836, 8, 341, 3244, 83, 1669, 501, 14597, 58699, 1155, 340, 16867, 17853, 87689, 2822, 3244, 83, 1364, 1474, 445, 13683, 1138, 3174, 1669, 17853...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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 TestAzurermCompute_Image(t *testing.T) { dummyError := errors.New("this is an error") tests := []struct { test string mocks func(*repository.MockComputeRepository, *mocks.AlerterInterface) assertExpected func(t *testing.T, got []*resource.Resource) wantErr error }{ { test: "no images", mocks: func(repository *repository.MockComputeRepository, alerter *mocks.AlerterInterface) { repository.On("ListAllImages").Return([]*armcompute.Image{}, nil) }, assertExpected: func(t *testing.T, got []*resource.Resource) { assert.Len(t, got, 0) }, }, { test: "error listing images", mocks: func(repository *repository.MockComputeRepository, alerter *mocks.AlerterInterface) { repository.On("ListAllImages").Return(nil, dummyError) }, wantErr: remoteerr.NewResourceListingError(dummyError, resourceazure.AzureImageResourceType), }, { test: "multiple images including an invalid ID", mocks: func(repository *repository.MockComputeRepository, alerter *mocks.AlerterInterface) { repository.On("ListAllImages").Return([]*armcompute.Image{ { Resource: armcompute.Resource{ ID: to.StringPtr("/subscriptions/4e411884-65b0-4911-bc80-52f9a21942a2/resourceGroups/testgroup/providers/Microsoft.Compute/images/image1"), Name: to.StringPtr("image1"), }, }, { Resource: armcompute.Resource{ ID: to.StringPtr("/subscriptions/4e411884-65b0-4911-bc80-52f9a21942a2/resourceGroups/testgroup/providers/Microsoft.Compute/images/image2"), Name: to.StringPtr("image2"), }, }, { Resource: armcompute.Resource{ ID: to.StringPtr("/invalid-id/image3"), Name: to.StringPtr("image3"), }, }, }, nil) }, assertExpected: func(t *testing.T, got []*resource.Resource) { assert.Len(t, got, 2) assert.Equal(t, got[0].ResourceId(), "/subscriptions/4e411884-65b0-4911-bc80-52f9a21942a2/resourceGroups/testgroup/providers/Microsoft.Compute/images/image1") assert.Equal(t, got[0].ResourceType(), resourceazure.AzureImageResourceType) assert.Equal(t, got[1].ResourceId(), "/subscriptions/4e411884-65b0-4911-bc80-52f9a21942a2/resourceGroups/testgroup/providers/Microsoft.Compute/images/image2") assert.Equal(t, got[1].ResourceType(), resourceazure.AzureImageResourceType) }, }, } providerVersion := "2.71.0" schemaRepository := testresource.InitFakeSchemaRepository("azurerm", providerVersion) resourceazure.InitResourcesMetadata(schemaRepository) factory := terraform.NewTerraformResourceFactory(schemaRepository) for _, c := range tests { t.Run(c.test, func(tt *testing.T) { scanOptions := ScannerOptions{} remoteLibrary := common.NewRemoteLibrary() // Initialize mocks alerter := &mocks.AlerterInterface{} fakeRepo := &repository.MockComputeRepository{} c.mocks(fakeRepo, alerter) remoteLibrary.AddEnumerator(azurerm.NewAzurermImageEnumerator(fakeRepo, factory)) testFilter := &filter.MockFilter{} testFilter.On("IsTypeIgnored", mock.Anything).Return(false) s := NewScanner(remoteLibrary, alerter, scanOptions, testFilter) got, err := s.Resources() assert.Equal(tt, c.wantErr, err) if err != nil { return } c.assertExpected(tt, got) alerter.AssertExpectations(tt) fakeRepo.AssertExpectations(tt) }) } }
explode_data.jsonl/43881
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 1424 }
[ 2830, 3393, 37199, 324, 4195, 46254, 45949, 1155, 353, 8840, 836, 8, 1476, 2698, 8574, 1454, 1669, 5975, 7121, 445, 574, 374, 458, 1465, 5130, 78216, 1669, 3056, 1235, 341, 197, 18185, 1843, 914, 198, 197, 2109, 25183, 688, 2915, 4071, ...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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 TestOpStrictNotEqual(t *testing.T) { assert := assert.New(t) jl := NewEmpty() AddOpStrictNotEqual(jl) TestCases{ // http://jsonlogic.com/operations.html {Logic: `{"!==":[1,2]}`, Data: `null`, Result: true}, {Logic: `{"!==":[1,"1"]}`, Data: `null`, Result: true}, // Zero/One param. {Logic: `{"!==":[]}`, Data: `null`, Err: true}, {Logic: `{"!==":[null]}`, Data: `null`, Err: true}, // Two params, primitives. {Logic: `{"!==":[null,null]}`, Data: `null`, Result: false}, {Logic: `{"!==":[false,false]}`, Data: `null`, Result: false}, {Logic: `{"!==":[3.0,3]}`, Data: `null`, Result: false}, {Logic: `{"!==":["",""]}`, Data: `null`, Result: false}, {Logic: `{"!==":["",3.0]}`, Data: `null`, Result: true}, // Non-primitives. {Logic: `{"!==":["",[]]}`, Data: `null`, Err: true}, }.Run(assert, jl) }
explode_data.jsonl/38297
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 366 }
[ 2830, 3393, 7125, 41857, 2623, 2993, 1155, 353, 8840, 836, 8, 341, 6948, 1669, 2060, 7121, 1155, 340, 12428, 75, 1669, 1532, 3522, 741, 37972, 7125, 41857, 2623, 2993, 3325, 75, 340, 73866, 37302, 515, 197, 197, 322, 1758, 1110, 2236, ...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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_DeleteNode_Negative_NodeExistsHasChildVolumes(t *testing.T) { // Arrange volumePluginMgr, _ := controllervolumetesting.GetTestVolumePluginMgr((t)) dsw := NewDesiredStateOfWorld(volumePluginMgr) nodeName := "node-name" dsw.AddNode(nodeName) podName := "pod-name" volumeName := api.UniqueDeviceName("volume-name") volumeSpec := controllervolumetesting.GetTestVolumeSpec(string(volumeName), volumeName) generatedVolumeName, podAddErr := dsw.AddPod(podName, volumeSpec, nodeName) if podAddErr != nil { t.Fatalf( "AddPod failed for pod %q. Expected: <no error> Actual: <%v>", podName, podAddErr) } // Act err := dsw.DeleteNode(nodeName) // Assert if err == nil { t.Fatalf("DeleteNode did not fail. Expected: <\"failed to delete node...the node still contains volumes in its list of volumes to attach\"> Actual: <no error>") } nodeExists := dsw.NodeExists(nodeName) if !nodeExists { t.Fatalf("Node %q no longer exists, it should.", nodeName) } volumesToAttach := dsw.GetVolumesToAttach() if len(volumesToAttach) != 1 { t.Fatalf("len(volumesToAttach) Expected: <1> Actual: <%v>", len(volumesToAttach)) } verifyVolumeToAttach(t, volumesToAttach, nodeName, generatedVolumeName, string(volumeName)) }
explode_data.jsonl/40742
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 453 }
[ 2830, 3393, 57418, 1955, 1604, 15060, 41340, 15575, 10281, 3652, 96325, 1155, 353, 8840, 836, 8, 341, 197, 322, 40580, 198, 5195, 4661, 11546, 25567, 11, 716, 1669, 683, 1100, 648, 1132, 57824, 287, 2234, 2271, 18902, 11546, 25567, 1188, ...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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 TestHexadecimal(t *testing.T) { validate := New() s := "ff0044" errs := validate.Var(s, "hexadecimal") Equal(t, errs, nil) s = "abcdefg" errs = validate.Var(s, "hexadecimal") NotEqual(t, errs, nil) AssertError(t, errs, "", "", "", "", "hexadecimal") i := true errs = validate.Var(i, "hexadecimal") NotEqual(t, errs, nil) AssertError(t, errs, "", "", "", "", "hexadecimal") }
explode_data.jsonl/77324
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 186 }
[ 2830, 3393, 20335, 49326, 1155, 353, 8840, 836, 8, 1476, 197, 7067, 1669, 1532, 2822, 1903, 1669, 330, 542, 15, 15, 19, 19, 698, 9859, 82, 1669, 9593, 87968, 1141, 11, 330, 17308, 49326, 1138, 197, 2993, 1155, 11, 70817, 11, 2092, 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...
1
func TestSugarWith(t *testing.T) { // Convenience functions to create expected error logs. ignored := func(msg interface{}) observer.LoggedEntry { return observer.LoggedEntry{ Entry: zapcore.Entry{Level: DPanicLevel, Message: _oddNumberErrMsg}, Context: []Field{Any("ignored", msg)}, } } nonString := func(pairs ...invalidPair) observer.LoggedEntry { return observer.LoggedEntry{ Entry: zapcore.Entry{Level: DPanicLevel, Message: _nonStringKeyErrMsg}, Context: []Field{Array("invalid", invalidPairs(pairs))}, } } tests := []struct { desc string args []interface{} expected []Field errLogs []observer.LoggedEntry }{ { desc: "nil args", args: nil, expected: []Field{}, errLogs: nil, }, { desc: "empty slice of args", args: []interface{}{}, expected: []Field{}, errLogs: nil, }, { desc: "just a dangling key", args: []interface{}{"should ignore"}, expected: []Field{}, errLogs: []observer.LoggedEntry{ignored("should ignore")}, }, { desc: "well-formed key-value pairs", args: []interface{}{"foo", 42, "true", "bar"}, expected: []Field{Int("foo", 42), String("true", "bar")}, errLogs: nil, }, { desc: "just a structured field", args: []interface{}{Int("foo", 42)}, expected: []Field{Int("foo", 42)}, errLogs: nil, }, { desc: "structured field and a dangling key", args: []interface{}{Int("foo", 42), "dangling"}, expected: []Field{Int("foo", 42)}, errLogs: []observer.LoggedEntry{ignored("dangling")}, }, { desc: "structured field and a dangling non-string key", args: []interface{}{Int("foo", 42), 13}, expected: []Field{Int("foo", 42)}, errLogs: []observer.LoggedEntry{ignored(13)}, }, { desc: "key-value pair and a dangling key", args: []interface{}{"foo", 42, "dangling"}, expected: []Field{Int("foo", 42)}, errLogs: []observer.LoggedEntry{ignored("dangling")}, }, { desc: "pairs, a structured field, and a dangling key", args: []interface{}{"first", "field", Int("foo", 42), "baz", "quux", "dangling"}, expected: []Field{String("first", "field"), Int("foo", 42), String("baz", "quux")}, errLogs: []observer.LoggedEntry{ignored("dangling")}, }, { desc: "one non-string key", args: []interface{}{"foo", 42, true, "bar"}, expected: []Field{Int("foo", 42)}, errLogs: []observer.LoggedEntry{nonString(invalidPair{2, true, "bar"})}, }, { desc: "pairs, structured fields, non-string keys, and a dangling key", args: []interface{}{"foo", 42, true, "bar", Int("structure", 11), 42, "reversed", "baz", "quux", "dangling"}, expected: []Field{Int("foo", 42), Int("structure", 11), String("baz", "quux")}, errLogs: []observer.LoggedEntry{ ignored("dangling"), nonString(invalidPair{2, true, "bar"}, invalidPair{5, 42, "reversed"}), }, }, } for _, tt := range tests { withSugar(t, DebugLevel, nil, func(logger *SugaredLogger, logs *observer.ObservedLogs) { logger.With(tt.args...).Info("") output := logs.AllUntimed() if len(tt.errLogs) > 0 { for i := range tt.errLogs { assert.Equal(t, tt.errLogs[i], output[i], "Unexpected error log at position %d for scenario %s.", i, tt.desc) } } assert.Equal(t, len(tt.errLogs)+1, len(output), "Expected only one non-error message to be logged in scenario %s.", tt.desc) assert.Equal(t, tt.expected, output[len(tt.errLogs)].Context, "Unexpected message context in scenario %s.", tt.desc) }) } }
explode_data.jsonl/5021
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 1547 }
[ 2830, 3393, 83414, 2354, 1155, 353, 8840, 836, 8, 341, 197, 322, 80648, 5746, 311, 1855, 3601, 1465, 18422, 624, 197, 58471, 1669, 2915, 8119, 3749, 28875, 22067, 5247, 3556, 5874, 341, 197, 853, 22067, 5247, 3556, 5874, 515, 298, 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 TestSizeRetention(t *testing.T) { db, delete := openTestDB(t, &Options{ BlockRanges: []int64{100}, }) defer func() { testutil.Ok(t, db.Close()) delete() }() blocks := []*BlockMeta{ {MinTime: 100, MaxTime: 200}, // Oldest block {MinTime: 200, MaxTime: 300}, {MinTime: 300, MaxTime: 400}, {MinTime: 400, MaxTime: 500}, {MinTime: 500, MaxTime: 600}, // Newest Block } for _, m := range blocks { createBlock(t, db.Dir(), genSeries(100, 10, m.MinTime, m.MaxTime)) } // Test that registered size matches the actual disk size. testutil.Ok(t, db.reload()) // Reload the db to register the new db size. testutil.Equals(t, len(blocks), len(db.Blocks())) // Ensure all blocks are registered. expSize := int64(prom_testutil.ToFloat64(db.metrics.blocksBytes)) // Use the the actual internal metrics. actSize := testutil.DirSize(t, db.Dir()) testutil.Equals(t, expSize, actSize, "registered size doesn't match actual disk size") // Decrease the max bytes limit so that a delete is triggered. // Check total size, total count and check that the oldest block was deleted. firstBlockSize := db.Blocks()[0].Size() sizeLimit := actSize - firstBlockSize db.opts.MaxBytes = sizeLimit // Set the new db size limit one block smaller that the actual size. testutil.Ok(t, db.reload()) // Reload the db to register the new db size. expBlocks := blocks[1:] actBlocks := db.Blocks() expSize = int64(prom_testutil.ToFloat64(db.metrics.blocksBytes)) actRetentCount := int(prom_testutil.ToFloat64(db.metrics.sizeRetentionCount)) actSize = testutil.DirSize(t, db.Dir()) testutil.Equals(t, 1, actRetentCount, "metric retention count mismatch") testutil.Equals(t, actSize, expSize, "metric db size doesn't match actual disk size") testutil.Assert(t, expSize <= sizeLimit, "actual size (%v) is expected to be less than or equal to limit (%v)", expSize, sizeLimit) testutil.Equals(t, len(blocks)-1, len(actBlocks), "new block count should be decreased from:%v to:%v", len(blocks), len(blocks)-1) testutil.Equals(t, expBlocks[0].MaxTime, actBlocks[0].meta.MaxTime, "maxT mismatch of the first block") testutil.Equals(t, expBlocks[len(expBlocks)-1].MaxTime, actBlocks[len(actBlocks)-1].meta.MaxTime, "maxT mismatch of the last block") }
explode_data.jsonl/64378
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 830 }
[ 2830, 3393, 1695, 86329, 1155, 353, 8840, 836, 8, 341, 20939, 11, 3698, 1669, 1787, 2271, 3506, 1155, 11, 609, 3798, 515, 197, 94940, 74902, 25, 3056, 396, 21, 19, 90, 16, 15, 15, 1583, 197, 3518, 16867, 2915, 368, 341, 197, 18185, ...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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 TestPrincipalMatch(t *testing.T) { testCases := []struct { principals Principal principal string expectedResult bool }{ {NewPrincipal("*"), "AccountNumber", true}, {NewPrincipal("arn:aws:iam::*"), "arn:aws:iam::AccountNumber:root", true}, {NewPrincipal("arn:aws:iam::AccountNumber:*"), "arn:aws:iam::TestAccountNumber:root", false}, } for i, testCase := range testCases { result := testCase.principals.Match(testCase.principal) if result != testCase.expectedResult { t.Fatalf("case %v: expected: %v, got: %v\n", i+1, testCase.expectedResult, result) } } }
explode_data.jsonl/39966
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 231 }
[ 2830, 3393, 31771, 8331, 1155, 353, 8840, 836, 8, 341, 18185, 37302, 1669, 3056, 1235, 341, 197, 25653, 5706, 1127, 257, 36309, 198, 197, 25653, 15702, 414, 914, 198, 197, 42400, 2077, 1807, 198, 197, 59403, 197, 197, 90, 3564, 31771, ...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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 TestWithTraceContext_given_context_without_transaction_it_should_return_same_envelope_without_change(t *testing.T) { ctx := context.Background() rootE := envelope.FromMessage("test message") e := WithTraceContext(ctx, rootE) assert.Same(t, rootE, e) }
explode_data.jsonl/46774
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 89 }
[ 2830, 3393, 2354, 6550, 1972, 57653, 8467, 39904, 28884, 14631, 43378, 12511, 33574, 6205, 18853, 39904, 15947, 1155, 353, 8840, 836, 8, 341, 20985, 1669, 2266, 19047, 2822, 33698, 36, 1669, 34398, 11439, 2052, 445, 1944, 1943, 1138, 7727, ...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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 TestDatasources_Vault_AppIDAuth(t *testing.T) { v := setupDatasourcesVaultTest(t) v.vc.Logical().Write("secret/foo", map[string]interface{}{"value": "bar"}) defer v.vc.Logical().Delete("secret/foo") err := v.vc.Sys().EnableAuth("app-id", "app-id", "") require.NoError(t, err) err = v.vc.Sys().EnableAuth("app-id2", "app-id", "") require.NoError(t, err) defer v.vc.Sys().DisableAuth("app-id") defer v.vc.Sys().DisableAuth("app-id2") _, err = v.vc.Logical().Write("auth/app-id/map/app-id/testappid", map[string]interface{}{ "display_name": "test_app_id", "value": "readpol", }) require.NoError(t, err) _, err = v.vc.Logical().Write("auth/app-id/map/user-id/testuserid", map[string]interface{}{ "value": "testappid", }) require.NoError(t, err) _, err = v.vc.Logical().Write("auth/app-id2/map/app-id/testappid", map[string]interface{}{ "display_name": "test_app_id", "value": "readpol", }) require.NoError(t, err) _, err = v.vc.Logical().Write("auth/app-id2/map/user-id/testuserid", map[string]interface{}{ "value": "testappid", }) require.NoError(t, err) o, e, err := cmd(t, "-d", "vault=vault:///secret", "-i", `{{(ds "vault" "foo").value}}`). withEnv("VAULT_ADDR", "http://"+v.addr). withEnv("VAULT_APP_ID", "testappid"). withEnv("VAULT_USER_ID", "testuserid"). run() assertSuccess(t, o, e, err, "bar") o, e, err = cmd(t, "-d", "vault=vault:///secret", "-i", `{{(ds "vault" "foo").value}}`). withEnv("VAULT_ADDR", "http://"+v.addr). withEnv("VAULT_APP_ID", "testappid"). withEnv("VAULT_USER_ID", "testuserid"). withEnv("VAULT_AUTH_APP_ID_MOUNT", "app-id2"). run() assertSuccess(t, o, e, err, "bar") }
explode_data.jsonl/57234
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 750 }
[ 2830, 3393, 47663, 2360, 2334, 945, 36117, 915, 5087, 1155, 353, 8840, 836, 8, 341, 5195, 1669, 6505, 47663, 2360, 79177, 2271, 1155, 692, 5195, 3133, 66, 5247, 938, 1005, 7985, 445, 20474, 60555, 497, 2415, 14032, 31344, 6257, 4913, 95...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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 TestVerifyPolyEval(t *testing.T) { threshold := uint64(2) p1, err := RandomPolynomial(rand.Reader, threshold-1) assert.NilError(t, err) p2, err := RandomPolynomial(rand.Reader, threshold-1) assert.NilError(t, err) for i := 0; i < 10; i++ { xi := KeyperX(i) vi1 := p1.Eval(xi) vi2 := p2.Eval(xi) assert.Assert(t, VerifyPolyEval(i, vi1, p1.Gammas(), threshold)) assert.Assert(t, VerifyPolyEval(i, vi2, p2.Gammas(), threshold)) assert.Assert(t, !VerifyPolyEval(i, vi1, p2.Gammas(), threshold)) assert.Assert(t, !VerifyPolyEval(i, vi2, p1.Gammas(), threshold)) assert.Assert(t, !VerifyPolyEval(i+1, vi1, p1.Gammas(), threshold)) assert.Assert(t, !VerifyPolyEval(i+1, vi2, p2.Gammas(), threshold)) } }
explode_data.jsonl/60070
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 327 }
[ 2830, 3393, 32627, 38164, 54469, 1155, 353, 8840, 836, 8, 341, 197, 28902, 1669, 2622, 21, 19, 7, 17, 692, 3223, 16, 11, 1848, 1669, 10612, 14658, 25358, 37595, 47431, 11, 12171, 12, 16, 340, 6948, 59678, 1454, 1155, 11, 1848, 692, ...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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 Test_Echo_Skip(t *testing.T) { e := newEcho(validator.Config{ Skipper: func(echo.Context) bool { return true }, }) req := httptest.NewRequest(http.MethodGet, "http://example.com/hello/world", nil) res := httptest.NewRecorder() e.ServeHTTP(res, req) require.Equal(t, http.StatusOK, res.Code) }
explode_data.jsonl/54628
{ "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, 2089, 958, 1098, 13389, 1155, 353, 8840, 836, 8, 341, 7727, 1669, 501, 74994, 7, 16112, 10753, 515, 197, 7568, 13389, 712, 25, 2915, 2026, 958, 9328, 8, 1807, 314, 470, 830, 1153, 197, 8824, 24395, 1669, 54320, 70334, 7527...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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 TestStateLock_MissingProposalWhenPOLSeenDoesNotUpdateLock(t *testing.T) { config := configSetup(t) logger := log.NewNopLogger() ctx, cancel := context.WithCancel(context.Background()) defer cancel() cs1, vss := makeState(ctx, t, makeStateArgs{config: config, logger: logger}) vs2, vs3, vs4 := vss[1], vss[2], vss[3] height, round := cs1.Height, cs1.Round partSize := types.BlockPartSizeBytes timeoutWaitCh := subscribe(ctx, t, cs1.eventBus, types.EventQueryTimeoutWait) proposalCh := subscribe(ctx, t, cs1.eventBus, types.EventQueryCompleteProposal) pv1, err := cs1.privValidator.GetPubKey(ctx) require.NoError(t, err) addr := pv1.Address() voteCh := subscribeToVoter(ctx, t, cs1, addr) newRoundCh := subscribe(ctx, t, cs1.eventBus, types.EventQueryNewRound) /* Round 0: cs1 creates a proposal for block B. Send a prevote for B from each of the validators to cs1. Send a precommit for nil from all of the validators to cs1. This ensures that cs1 will lock on B in this round but not precommit it. */ startTestRound(ctx, cs1, height, round) ensureNewRound(t, newRoundCh, height, round) ensureNewProposal(t, proposalCh, height, round) rs := cs1.GetRoundState() firstBlockID := types.BlockID{ Hash: rs.ProposalBlock.Hash(), PartSetHeader: rs.ProposalBlockParts.Header(), } ensurePrevote(t, voteCh, height, round) // prevote signAddVotes(ctx, t, cs1, tmproto.PrevoteType, config.ChainID(), firstBlockID, vs2, vs3, vs4) ensurePrecommit(t, voteCh, height, round) // our precommit // the proposed block should now be locked and our precommit added validatePrecommit(ctx, t, cs1, round, round, vss[0], firstBlockID.Hash, firstBlockID.Hash) // add precommits from the rest signAddVotes(ctx, t, cs1, tmproto.PrecommitType, config.ChainID(), types.BlockID{}, vs2, vs3, vs4) // timeout to new round ensureNewTimeout(t, timeoutWaitCh, height, round, cs1.voteTimeout(round).Nanoseconds()) /* Round 1: Create a new block, D but do not send it to cs1. Send a prevote for D from each of the validators to cs1. Check that cs1 does not update its locked block to this missed block D. */ incrementRound(vs2, vs3, vs4) round++ cs2 := newState(ctx, t, logger, cs1.state, vs2, kvstore.NewApplication()) require.NoError(t, err) prop, propBlock := decideProposal(ctx, t, cs2, vs2, vs2.Height, vs2.Round) require.NotNil(t, propBlock, "Failed to create proposal block with vs2") require.NotNil(t, prop, "Failed to create proposal block with vs2") partSet, err := propBlock.MakePartSet(partSize) require.NoError(t, err) secondBlockID := types.BlockID{ Hash: propBlock.Hash(), PartSetHeader: partSet.Header(), } require.NotEqual(t, secondBlockID.Hash, firstBlockID.Hash) ensureNewRound(t, newRoundCh, height, round) // prevote for nil since the proposal was not seen. ensurePrevoteMatch(t, voteCh, height, round, nil) // now lets add prevotes from everyone else for the new block signAddVotes(ctx, t, cs1, tmproto.PrevoteType, config.ChainID(), secondBlockID, vs2, vs3, vs4) ensurePrecommit(t, voteCh, height, round) validatePrecommit(ctx, t, cs1, round, 0, vss[0], nil, firstBlockID.Hash) }
explode_data.jsonl/54270
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 1155 }
[ 2830, 3393, 1397, 11989, 1245, 13577, 98637, 4498, 49303, 85675, 21468, 2623, 4289, 11989, 1155, 353, 8840, 836, 8, 341, 25873, 1669, 2193, 21821, 1155, 340, 17060, 1669, 1487, 7121, 45, 453, 7395, 741, 20985, 11, 9121, 1669, 2266, 26124,...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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 TestDeleteInstanceIDUnexpectedError(t *testing.T) { var tr *http.Request ts := httptest.NewServer(http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) { tr = r w.WriteHeader(511) w.Header().Set("Content-Type", "application/json") w.Write([]byte("{}")) })) defer ts.Close() ctx := context.Background() client, err := NewClient(ctx, testIIDConfig) if err != nil { t.Fatal(err) } client.endpoint = ts.URL want := "unexpected http response with status: 511\n{}" err = client.DeleteInstanceID(ctx, "test-iid") if err == nil || err.Error() != want { t.Errorf("DeleteInstanceID() = %v; want = %v", err, want) } if !IsUnknown(err) { t.Errorf("IsUnknown() = false; want = true") } if !errorutils.IsUnknown(err) { t.Errorf("errorutils.IsUnknown() = false; want = true") } if tr == nil { t.Fatalf("Request = nil; want non-nil") } if tr.Method != http.MethodDelete { t.Errorf("Method = %q; want = %q", tr.Method, http.MethodDelete) } if tr.URL.Path != "/project/test-project/instanceId/test-iid" { t.Errorf("Path = %q; want = %q", tr.URL.Path, "/project/test-project/instanceId/test-iid") } if h := tr.Header.Get("Authorization"); h != "Bearer test-token" { t.Errorf("Authorization = %q; want = %q", h, "Bearer test-token") } }
explode_data.jsonl/54625
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 508 }
[ 2830, 3393, 6435, 2523, 915, 29430, 1454, 1155, 353, 8840, 836, 8, 341, 2405, 489, 353, 1254, 9659, 198, 57441, 1669, 54320, 70334, 7121, 5475, 19886, 89164, 18552, 3622, 1758, 37508, 11, 435, 353, 1254, 9659, 8, 341, 197, 25583, 284, ...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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_Writer_Callback(t *testing.T) { count := int64(-1) onWrite := func(c int64) { count = c } cw := NewWriterCallback(onWrite, nil) buf := []byte{1, 2, 3, 4, 5, 6} _, err := cw.Write(buf) must(t, err) assert.Equal(t, count, int64(6)) _, err = cw.Write(buf) must(t, err) assert.Equal(t, count, int64(12)) _, err = cw.Write(buf) must(t, err) assert.Equal(t, count, int64(18)) _, err = cw.Write(buf) must(t, err) assert.Equal(t, count, int64(24)) }
explode_data.jsonl/18870
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 222 }
[ 2830, 3393, 2763, 2542, 55102, 1155, 353, 8840, 836, 8, 341, 18032, 1669, 526, 21, 19, 4080, 16, 340, 24630, 7985, 1669, 2915, 1337, 526, 21, 19, 8, 314, 1760, 284, 272, 555, 1444, 86, 1669, 1532, 6492, 7494, 29355, 7985, 11, 2092, ...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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 TestPyModuleGetFilename(t *testing.T) { fmt.Println(assert.CallerInfo()[0]) assert.Equal(t, "", pymodule.GetFilename(nil)) queue := pyimport.ImportModule("queue") defer py.DecRef(queue) queueRefCnt := py.RefCnt(queue) defer func() { assert.Equal(t, queueRefCnt, py.RefCnt(queue)) }() name := pymodule.GetFilename(queue) assert.True(t, strings.HasSuffix(name, "/queue.py")) }
explode_data.jsonl/33472
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 153 }
[ 2830, 3393, 13828, 3332, 1949, 20759, 1155, 353, 8840, 836, 8, 341, 11009, 12419, 75846, 727, 13956, 1731, 10116, 15, 9604, 6948, 12808, 1155, 11, 7342, 45760, 1756, 2234, 20759, 27907, 4390, 46993, 1669, 4510, 474, 67275, 3332, 445, 4584...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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 TestCannotCommitWithoutNewTermEntry(t *testing.T) { tt := newNetwork(nil, nil, nil, nil, nil) tt.send(pb.Message{From: 1, To: 1, Type: pb.MsgHup}) // 0 cannot reach 2,3,4 tt.cut(1, 3) tt.cut(1, 4) tt.cut(1, 5) tt.send(pb.Message{From: 1, To: 1, Type: pb.MsgProp, Entries: []pb.Entry{{Data: []byte("some data")}}}) tt.send(pb.Message{From: 1, To: 1, Type: pb.MsgProp, Entries: []pb.Entry{{Data: []byte("some data")}}}) sm := tt.peers[1].(*raft) if sm.raftLog.committed != 1 { t.Errorf("committed = %d, want %d", sm.raftLog.committed, 1) } // network recovery tt.recover() // avoid committing ChangeTerm proposal tt.ignore(pb.MsgApp) // elect 2 as the new leader with term 2 tt.send(pb.Message{From: 2, To: 2, Type: pb.MsgHup}) // no log entries from previous term should be committed sm = tt.peers[2].(*raft) if sm.raftLog.committed != 1 { t.Errorf("committed = %d, want %d", sm.raftLog.committed, 1) } tt.recover() // send heartbeat; reset wait tt.send(pb.Message{From: 2, To: 2, Type: pb.MsgBeat}) // append an entry at current term tt.send(pb.Message{From: 2, To: 2, Type: pb.MsgProp, Entries: []pb.Entry{{Data: []byte("some data")}}}) // expect the committed to be advanced if sm.raftLog.committed != 5 { t.Errorf("committed = %d, want %d", sm.raftLog.committed, 5) } }
explode_data.jsonl/67337
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 540 }
[ 2830, 3393, 17444, 33441, 26040, 3564, 17249, 5874, 1155, 353, 8840, 836, 8, 341, 3244, 83, 1669, 501, 12320, 27907, 11, 2092, 11, 2092, 11, 2092, 11, 2092, 340, 3244, 83, 5219, 76878, 8472, 90, 3830, 25, 220, 16, 11, 2014, 25, 220,...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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 TestWithAuthUserPass(t *testing.T) { t.Parallel() Convey("Given a username, password and dialer", t, func() { user := "testuser" pass := "testpass" dialer := &mockDialerStruct{} Convey("And Dial is called with username and password", func() { _, err := mockDial(dialer, WithAuthUserPass(user, pass)) Convey("Then no error should be encountered", func() { So(err, ShouldBeNil) }) }) }) }
explode_data.jsonl/53406
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 158 }
[ 2830, 3393, 2354, 5087, 1474, 12187, 1155, 353, 8840, 836, 8, 341, 3244, 41288, 7957, 2822, 93070, 5617, 445, 22043, 264, 5934, 11, 3552, 323, 27860, 261, 497, 259, 11, 2915, 368, 341, 197, 19060, 1669, 330, 1944, 872, 698, 197, 41431...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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 TestRecordsAdd(t *testing.T) { rs := records([]*record{ newRecord("rls-a.v1", releaseStub("rls-a", 1, "default", rspb.StatusSuperseded)), newRecord("rls-a.v2", releaseStub("rls-a", 2, "default", rspb.StatusDeployed)), }) var tests = []struct { desc string key string ok bool rec *record }{ { "add valid key", "rls-a.v3", false, newRecord("rls-a.v3", releaseStub("rls-a", 3, "default", rspb.StatusSuperseded)), }, { "add already existing key", "rls-a.v1", true, newRecord("rls-a.v1", releaseStub("rls-a", 1, "default", rspb.StatusDeployed)), }, } for _, tt := range tests { if err := rs.Add(tt.rec); err != nil { if !tt.ok { t.Fatalf("failed: %q: %s\n", tt.desc, err) } } } }
explode_data.jsonl/62484
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 366 }
[ 2830, 3393, 25876, 2212, 1155, 353, 8840, 836, 8, 341, 41231, 1669, 7424, 85288, 8548, 515, 197, 8638, 6471, 445, 2381, 82, 7409, 3133, 16, 497, 4879, 33838, 445, 2381, 82, 7409, 497, 220, 16, 11, 330, 2258, 497, 42160, 65, 10538, 1...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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 TestOrderingServicePermanentCrash(t *testing.T) { testOrderingServicePermanentCrash(t, blockDelivererConsumerWithRecv) testOrderingServicePermanentCrash(t, blockDelivererConsumerWithSend) connWG.Wait() }
explode_data.jsonl/60875
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 67 }
[ 2830, 3393, 4431, 287, 1860, 78793, 16001, 988, 1155, 353, 8840, 836, 8, 341, 18185, 4431, 287, 1860, 78793, 16001, 988, 1155, 11, 2504, 16532, 1524, 261, 29968, 2354, 63483, 340, 18185, 4431, 287, 1860, 78793, 16001, 988, 1155, 11, 250...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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 TestParseScroll(t *testing.T) { fulltext := `--- time: '2016-02-17 06:34:59' last_modified: '2017-06-09 20:00:38' document: doco1 entry: entro1 --- This is some text --- time: '2015-02-16 06:34:59' last_modified: '2015-02-16 06:34:59' document: doco1 entry: entro0 --- First entry --- time: '2016-02-17 06:34:59' last_modified: '2016-02-17 06:34:59' document: doco1 entry: entro1 --- This is some ` docs, err := ParseScroll(fulltext) assert.Equal(t, nil, err) assert.Equal(t, 3, len(docs)) // Test whether Documents can be marhsalled/unmarshalled b, _ := json.Marshal(docs) var docs2 Documents json.Unmarshal(b, &docs2) assert.Equal(t, docs, docs) docString, err := docs[0].String() assert.Nil(t, err) assert.Equal(t, "---\ntime: 2015-02-16 06:34:59\nlast_modified: 2015-02-16 06:34:59\ndocument: doco1\nentry: entro0\ntags: []\n---\n\nFirst entry", docString) docsString, err := docs.String() assert.Nil(t, err) assert.Equal(t, "---\ntime: 2015-02-16 06:34:59\nlast_modified: 2015-02-16 06:34:59\ndocument: doco1\nentry: entro0\ntags: []\n---\n\nFirst entry\n\n---\ntime: 2016-02-17 06:34:59\nlast_modified: 2016-02-17 06:34:59\ndocument: doco1\nentry: entro1\ntags: []\n---\n\nThis is some\n\n---\ntime: 2016-02-17 06:34:59\nlast_modified: 2017-06-09 20:00:38\ndocument: doco1\nentry: entro1\ntags: []\n---\n\nThis is some text", docsString) docsString, err = docs.String("doco1") fmt.Println("+++++++") fmt.Println(docsString) fmt.Println("+++++++") assert.Nil(t, err) assert.Equal(t, "---\ntime: 2015-02-16 06:34:59\nlast_modified: 2015-02-16 06:34:59\ndocument: doco1\nentry: entro0\ntags: []\n---\n\nFirst entry\n\n---\ntime: 2016-02-17 06:34:59\nlast_modified: 2017-06-09 20:00:38\ndocument: doco1\nentry: entro1\ntags: []\n---\n\nThis is some text", docsString) }
explode_data.jsonl/30236
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 869 }
[ 2830, 3393, 14463, 8425, 1155, 353, 8840, 836, 8, 972, 94042, 1318, 1669, 1565, 4421, 4474, 1678, 25, 364, 17, 15, 16, 21, 12, 15, 17, 12, 16, 22, 220, 15, 21, 25, 18, 19, 25, 20, 24, 9739, 4259, 37749, 25, 364, 17, 15, 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...
1
func TestAllKeys(t *testing.T) { initConfigs() ks := sort.StringSlice{ "title", "author.bio", "author.e-mail", "author.github", "author.name", "newkey", "owner.organization", "owner.dob", "owner.bio", "name", "beard", "ppu", "batters.batter", "hobbies", "clothing.jacket", "clothing.trousers", "default.import_path", "default.name", "default.version", "clothing.pants.size", "age", "hacker", "id", "type", "eyes", "p_id", "p_ppu", "p_batters.batter.type", "p_type", "p_name", "foos", "title_dotenv", "type_dotenv", "name_dotenv", } dob, _ := time.Parse(time.RFC3339, "1979-05-27T07:32:00Z") all := map[string]interface{}{ "owner": map[string]interface{}{ "organization": "MongoDB", "bio": "MongoDB Chief Developer Advocate & Hacker at Large", "dob": dob, }, "title": "TOML Example", "author": map[string]interface{}{ "e-mail": "fake@localhost", "github": "https://github.com/Unknown", "name": "Unknown", "bio": "Gopher.\nCoding addict.\nGood man.\n", }, "ppu": 0.55, "eyes": "brown", "clothing": map[string]interface{}{ "trousers": "denim", "jacket": "leather", "pants": map[string]interface{}{"size": "large"}, }, "default": map[string]interface{}{ "import_path": "gopkg.in/ini.v1", "name": "ini", "version": "v1", }, "id": "0001", "batters": map[string]interface{}{ "batter": []interface{}{ map[string]interface{}{"type": "Regular"}, map[string]interface{}{"type": "Chocolate"}, map[string]interface{}{"type": "Blueberry"}, map[string]interface{}{"type": "Devil's Food"}, }, }, "hacker": true, "beard": true, "hobbies": []interface{}{ "skateboarding", "snowboarding", "go", }, "age": 35, "type": "donut", "newkey": "remote", "name": "Cake", "p_id": "0001", "p_ppu": "0.55", "p_name": "Cake", "p_batters": map[string]interface{}{ "batter": map[string]interface{}{"type": "Regular"}, }, "p_type": "donut", "foos": []map[string]interface{}{ { "foo": []map[string]interface{}{ {"key": 1}, {"key": 2}, {"key": 3}, {"key": 4}, }, }, }, "title_dotenv": "DotEnv Example", "type_dotenv": "donut", "name_dotenv": "Cake", } allkeys := sort.StringSlice(AllKeys()) allkeys.Sort() ks.Sort() assert.Equal(t, ks, allkeys) assert.Equal(t, all, AllSettings()) }
explode_data.jsonl/9886
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 1210 }
[ 2830, 3393, 2403, 8850, 1155, 353, 8840, 836, 8, 341, 28248, 84905, 2822, 197, 2787, 1669, 3378, 6431, 33236, 515, 197, 197, 82727, 756, 197, 197, 1, 3094, 78818, 756, 197, 197, 1, 3094, 1734, 11468, 756, 197, 197, 1, 3094, 11021, 7...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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 TestCollectorOrderOfArguments(t *testing.T) { jaeger := v1.NewJaeger(types.NamespacedName{Name: "my-instance"}) jaeger.Spec.Collector.Options = v1.NewOptions(map[string]interface{}{ "b-option": "b-value", "a-option": "a-value", "c-option": "c-value", }) a := NewCollector(jaeger) dep := a.Get() assert.Len(t, dep.Spec.Template.Spec.Containers, 1) assert.Len(t, dep.Spec.Template.Spec.Containers[0].Args, 4) assert.True(t, strings.HasPrefix(dep.Spec.Template.Spec.Containers[0].Args[0], "--a-option")) assert.True(t, strings.HasPrefix(dep.Spec.Template.Spec.Containers[0].Args[1], "--b-option")) assert.True(t, strings.HasPrefix(dep.Spec.Template.Spec.Containers[0].Args[2], "--c-option")) // the following are added automatically assert.True(t, strings.HasPrefix(dep.Spec.Template.Spec.Containers[0].Args[3], "--sampling.strategies-file")) }
explode_data.jsonl/59533
{ "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, 53694, 4431, 2124, 19139, 1155, 353, 8840, 836, 8, 341, 197, 5580, 1878, 1669, 348, 16, 7121, 52445, 1878, 52613, 98932, 68552, 675, 63121, 25, 330, 2408, 73655, 23625, 197, 5580, 1878, 36473, 727, 24605, 269, 22179, 284, 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 TestRuleORUsage(t *testing.T) { common.Log.Debug("Entering function: %s", common.GetFunctionName()) sqls := []string{ `SELECT c1,c2,c3 FROM tab WHERE c1 = 14 OR c2 = 17;`, } for _, sql := range sqls { q, err := NewQuery4Audit(sql) if err == nil { rule := q.RuleORUsage() if rule.Item != "ARG.008" { t.Error("Rule not match:", rule.Item, "Expect : ARG.008") } } else { t.Error("sqlparser.Parse Error:", err) } } common.Log.Debug("Exiting function: %s", common.GetFunctionName()) }
explode_data.jsonl/76806
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 220 }
[ 2830, 3393, 11337, 868, 14783, 1155, 353, 8840, 836, 8, 341, 83825, 5247, 20345, 445, 82867, 729, 25, 1018, 82, 497, 4185, 2234, 5152, 675, 2398, 30633, 82, 1669, 3056, 917, 515, 197, 197, 63, 4858, 272, 16, 10109, 17, 10109, 18, 42...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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 TestGetExtensionsWithMissingExtensions(t *testing.T) { msg := &pb.MyMessage{} ext1 := &pb.Ext{} if err := proto.SetExtension(msg, pb.E_Ext_More, ext1); err != nil { t.Fatalf("Could not set ext1: %s", err) } exts, err := proto.GetExtensions(msg, []*proto.ExtensionDesc{ pb.E_Ext_More, pb.E_Ext_Text, }) if err != nil { t.Fatalf("GetExtensions() failed: %s", err) } if exts[0] != ext1 { t.Errorf("ext1 not in returned extensions: %T %v", exts[0], exts[0]) } if exts[1] != nil { t.Errorf("ext2 in returned extensions: %T %v", exts[1], exts[1]) } }
explode_data.jsonl/55061
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 258 }
[ 2830, 3393, 1949, 31282, 2354, 25080, 31282, 1155, 353, 8840, 836, 8, 341, 21169, 1669, 609, 16650, 27054, 2052, 16094, 95450, 16, 1669, 609, 16650, 16146, 16094, 743, 1848, 1669, 18433, 4202, 12049, 8119, 11, 17310, 5142, 62, 6756, 1245,...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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 TestAggregationBuiltinGroupConcat(t *testing.T) { store, clean := testkit.CreateMockStore(t) defer clean() tk := testkit.NewTestKit(t, store) tk.MustExec("use test") tk.MustExec("create table t(a varchar(100))") tk.MustExec("create table d(a varchar(100))") tk.MustExec("insert into t values('hello'), ('hello')") result := tk.MustQuery("select group_concat(a) from t") result.Check(testkit.Rows("hello,hello")) tk.MustExec("set @@group_concat_max_len=7") result = tk.MustQuery("select group_concat(a) from t") result.Check(testkit.Rows("hello,h")) tk.MustQuery("show warnings").Check(testutil.RowsWithSep("|", "Warning 1260 Some rows were cut by GROUPCONCAT(test.t.a)")) _, err := tk.Exec("insert into d select group_concat(a) from t") require.Equal(t, errors.ErrCode(mysql.ErrCutValueGroupConcat), errors.Cause(err).(*terror.Error).Code()) _, err = tk.Exec("set sql_mode=''") require.NoError(t, err) tk.MustExec("insert into d select group_concat(a) from t") tk.MustQuery("show warnings").Check(testutil.RowsWithSep("|", "Warning 1260 Some rows were cut by GROUPCONCAT(test.t.a)")) tk.MustQuery("select * from d").Check(testkit.Rows("hello,h")) }
explode_data.jsonl/65448
{ "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, 9042, 34442, 33, 25628, 2808, 78440, 1155, 353, 8840, 836, 8, 341, 57279, 11, 4240, 1669, 1273, 8226, 7251, 11571, 6093, 1155, 340, 16867, 4240, 2822, 3244, 74, 1669, 1273, 8226, 7121, 2271, 7695, 1155, 11, 3553, 340, 3244, ...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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 TestServerKeyAuth(t *testing.T) { ta := testauthority.New() priv, pub, err := ta.GenerateKeyPair("") require.NoError(t, err) caSigner, err := ssh.ParsePrivateKey(priv) require.NoError(t, err) ca, err := types.NewCertAuthority(types.CertAuthoritySpecV2{ Type: types.HostCA, ClusterName: "cluster-name", ActiveKeys: types.CAKeySet{ SSH: []*types.SSHKeyPair{{ PrivateKey: priv, PrivateKeyType: types.PrivateKeyType_RAW, PublicKey: pub, }}, }, Roles: nil, SigningAlg: types.CertAuthoritySpecV2_RSA_SHA2_256, }) require.NoError(t, err) s := &server{ log: utils.NewLoggerForTests(), localAccessPoint: mockAccessPoint{ ca: ca, }, } con := mockSSHConnMetadata{} tests := []struct { desc string key ssh.PublicKey wantExtensions map[string]string wantErr require.ErrorAssertionFunc }{ { desc: "host cert", key: func() ssh.PublicKey { rawCert, err := ta.GenerateHostCert(services.HostCertParams{ CASigner: caSigner, CASigningAlg: defaults.CASignatureAlgorithm, PublicHostKey: pub, HostID: "host-id", NodeName: con.User(), ClusterName: "host-cluster-name", Role: types.RoleNode, }) require.NoError(t, err) key, _, _, _, err := ssh.ParseAuthorizedKey(rawCert) require.NoError(t, err) return key }(), wantExtensions: map[string]string{ extHost: con.User(), utils.ExtIntCertType: utils.ExtIntCertTypeHost, extCertRole: string(types.RoleNode), extAuthority: "host-cluster-name", }, wantErr: require.NoError, }, { desc: "user cert", key: func() ssh.PublicKey { rawCert, err := ta.GenerateUserCert(services.UserCertParams{ CASigner: caSigner, CASigningAlg: defaults.CASignatureAlgorithm, PublicUserKey: pub, Username: con.User(), AllowedLogins: []string{con.User()}, Roles: []string{"dev", "admin"}, RouteToCluster: "user-cluster-name", CertificateFormat: constants.CertificateFormatStandard, TTL: time.Minute, }) require.NoError(t, err) key, _, _, _, err := ssh.ParseAuthorizedKey(rawCert) require.NoError(t, err) return key }(), wantExtensions: map[string]string{ extHost: con.User(), utils.ExtIntCertType: utils.ExtIntCertTypeUser, extCertRole: "dev", extAuthority: "user-cluster-name", }, wantErr: require.NoError, }, { desc: "not a cert", key: func() ssh.PublicKey { key, _, _, _, err := ssh.ParseAuthorizedKey(pub) require.NoError(t, err) return key }(), wantErr: require.Error, }, } for _, tt := range tests { t.Run(tt.desc, func(t *testing.T) { perm, err := s.keyAuth(con, tt.key) tt.wantErr(t, err) if err == nil { require.Empty(t, cmp.Diff(perm, &ssh.Permissions{Extensions: tt.wantExtensions})) } }) } }
explode_data.jsonl/43522
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 1476 }
[ 2830, 3393, 5475, 1592, 5087, 1155, 353, 8840, 836, 8, 341, 197, 2565, 1669, 1273, 84454, 7121, 741, 71170, 11, 6675, 11, 1848, 1669, 9450, 57582, 1592, 12443, 31764, 17957, 35699, 1155, 11, 1848, 340, 197, 924, 7264, 261, 11, 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, 1...
1
func TestLoggers(t *testing.T) { Init("logs", "debug", 0) CLog().Debugf("format debug clog msg [%s]", "test clog msg") CLog().WithFields(logrus.Fields{"name": "clog_test", "type": "clog"}).Debugf("format debug clog msg [%s]", "test clog msg") VLog().Debugf("format debug vlog msg [%s]", "test vlog msg") VLog().WithFields(logrus.Fields{"name": "vlog_test", "type": "vlog"}).Debugf("format debug vlog msg [%s]", "test vlog msg") }
explode_data.jsonl/445
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 175 }
[ 2830, 3393, 2201, 10637, 1155, 353, 8840, 836, 8, 341, 98762, 445, 22081, 497, 330, 8349, 497, 220, 15, 692, 6258, 2201, 1005, 7939, 69, 445, 2243, 7390, 272, 839, 3750, 23610, 82, 19076, 330, 1944, 272, 839, 3750, 1138, 6258, 2201, ...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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 TestGetLendingInfo(t *testing.T) { t.Parallel() if !areTestAPIKeysSet() { t.Skip() } _, err := f.GetLendingInfo(context.Background()) if err != nil { t.Error(err) } }
explode_data.jsonl/15178
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 80 }
[ 2830, 3393, 1949, 43, 2459, 1731, 1155, 353, 8840, 836, 8, 341, 3244, 41288, 7957, 741, 743, 753, 546, 2271, 7082, 8850, 1649, 368, 341, 197, 3244, 57776, 741, 197, 532, 197, 6878, 1848, 1669, 282, 2234, 43, 2459, 1731, 5378, 19047, ...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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 TestUnmarshalConfig(t *testing.T) { registries, err := GetRegistries(&types.SystemContext{ SystemRegistriesConfPath: "testdata/unmarshal.conf", SystemRegistriesConfDirPath: "testdata/this-does-not-exist", }) assert.Nil(t, err) assert.Equal(t, 4, len(registries)) }
explode_data.jsonl/62231
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 108 }
[ 2830, 3393, 1806, 27121, 2648, 1155, 353, 8840, 836, 8, 341, 37013, 380, 4019, 11, 1848, 1669, 2126, 3477, 380, 4019, 2099, 9242, 16620, 1972, 515, 197, 5816, 3477, 380, 4019, 15578, 1820, 25, 262, 330, 92425, 35217, 27121, 13937, 756, ...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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 TestFind(t *testing.T) { var users = []User{ *GetUser("find", Config{}), *GetUser("find", Config{}), *GetUser("find", Config{}), } if err := DB.Create(&users).Error; err != nil { t.Fatalf("errors happened when create users: %v", err) } t.Run("First", func(t *testing.T) { var first User if err := DB.Where("name = ?", "find").First(&first).Error; err != nil { t.Errorf("errors happened when query first: %v", err) } else { CheckUser(t, first, users[0]) } }) t.Run("Last", func(t *testing.T) { var last User if err := DB.Where("name = ?", "find").Last(&last).Error; err != nil { t.Errorf("errors happened when query last: %v", err) } else { CheckUser(t, last, users[2]) } }) var all []User if err := DB.Where("name = ?", "find").Find(&all).Error; err != nil || len(all) != 3 { t.Errorf("errors happened when query find: %v, length: %v", err, len(all)) } else { for idx, user := range users { t.Run("FindAll#"+strconv.Itoa(idx+1), func(t *testing.T) { CheckUser(t, all[idx], user) }) } } t.Run("FirstMap", func(t *testing.T) { var first = map[string]interface{}{} if err := DB.Model(&User{}).Where("name = ?", "find").First(first).Error; err != nil { t.Errorf("errors happened when query first: %v", err) } else { for _, name := range []string{"Name", "Age", "Birthday"} { t.Run(name, func(t *testing.T) { dbName := DB.NamingStrategy.ColumnName("", name) switch name { case "Name": if _, ok := first[dbName].(string); !ok { t.Errorf("invalid data type for %v, got %#v", dbName, first[dbName]) } case "Age": if _, ok := first[dbName].(uint); !ok { t.Errorf("invalid data type for %v, got %#v", dbName, first[dbName]) } case "Birthday": if _, ok := first[dbName].(*time.Time); !ok { t.Errorf("invalid data type for %v, got %#v", dbName, first[dbName]) } } reflectValue := reflect.Indirect(reflect.ValueOf(users[0])) AssertEqual(t, first[dbName], reflectValue.FieldByName(name).Interface()) }) } } }) t.Run("FirstMapWithTable", func(t *testing.T) { var first = map[string]interface{}{} if err := DB.Table("users").Where("name = ?", "find").Find(first).Error; err != nil { t.Errorf("errors happened when query first: %v", err) } else { for _, name := range []string{"Name", "Age", "Birthday"} { t.Run(name, func(t *testing.T) { dbName := DB.NamingStrategy.ColumnName("", name) resultType := reflect.ValueOf(first[dbName]).Type().Name() switch name { case "Name": if !strings.Contains(resultType, "string") { t.Errorf("invalid data type for %v, got %v %#v", dbName, resultType, first[dbName]) } case "Age": if !strings.Contains(resultType, "int") { t.Errorf("invalid data type for %v, got %v %#v", dbName, resultType, first[dbName]) } case "Birthday": if !strings.Contains(resultType, "Time") && !(DB.Dialector.Name() == "sqlite" && strings.Contains(resultType, "string")) { t.Errorf("invalid data type for %v, got %v %#v", dbName, resultType, first[dbName]) } } reflectValue := reflect.Indirect(reflect.ValueOf(users[0])) AssertEqual(t, first[dbName], reflectValue.FieldByName(name).Interface()) }) } } }) t.Run("FirstPtrMap", func(t *testing.T) { var first = map[string]interface{}{} if err := DB.Model(&User{}).Where("name = ?", "find").First(&first).Error; err != nil { t.Errorf("errors happened when query first: %v", err) } else { for _, name := range []string{"Name", "Age", "Birthday"} { t.Run(name, func(t *testing.T) { dbName := DB.NamingStrategy.ColumnName("", name) reflectValue := reflect.Indirect(reflect.ValueOf(users[0])) AssertEqual(t, first[dbName], reflectValue.FieldByName(name).Interface()) }) } } }) t.Run("FirstSliceOfMap", func(t *testing.T) { var allMap = []map[string]interface{}{} if err := DB.Model(&User{}).Where("name = ?", "find").Find(&allMap).Error; err != nil { t.Errorf("errors happened when query find: %v", err) } else { for idx, user := range users { t.Run("FindAllMap#"+strconv.Itoa(idx+1), func(t *testing.T) { for _, name := range []string{"Name", "Age", "Birthday"} { t.Run(name, func(t *testing.T) { dbName := DB.NamingStrategy.ColumnName("", name) switch name { case "Name": if _, ok := allMap[idx][dbName].(string); !ok { t.Errorf("invalid data type for %v, got %#v", dbName, allMap[idx][dbName]) } case "Age": if _, ok := allMap[idx][dbName].(uint); !ok { t.Errorf("invalid data type for %v, got %#v", dbName, allMap[idx][dbName]) } case "Birthday": if _, ok := allMap[idx][dbName].(*time.Time); !ok { t.Errorf("invalid data type for %v, got %#v", dbName, allMap[idx][dbName]) } } reflectValue := reflect.Indirect(reflect.ValueOf(user)) AssertEqual(t, allMap[idx][dbName], reflectValue.FieldByName(name).Interface()) }) } }) } } }) t.Run("FindSliceOfMapWithTable", func(t *testing.T) { var allMap = []map[string]interface{}{} if err := DB.Table("users").Where("name = ?", "find").Find(&allMap).Error; err != nil { t.Errorf("errors happened when query find: %v", err) } else { for idx, user := range users { t.Run("FindAllMap#"+strconv.Itoa(idx+1), func(t *testing.T) { for _, name := range []string{"Name", "Age", "Birthday"} { t.Run(name, func(t *testing.T) { dbName := DB.NamingStrategy.ColumnName("", name) resultType := reflect.ValueOf(allMap[idx][dbName]).Type().Name() switch name { case "Name": if !strings.Contains(resultType, "string") { t.Errorf("invalid data type for %v, got %v %#v", dbName, resultType, allMap[idx][dbName]) } case "Age": if !strings.Contains(resultType, "int") { t.Errorf("invalid data type for %v, got %v %#v", dbName, resultType, allMap[idx][dbName]) } case "Birthday": if !strings.Contains(resultType, "Time") && !(DB.Dialector.Name() == "sqlite" && strings.Contains(resultType, "string")) { t.Errorf("invalid data type for %v, got %v %#v", dbName, resultType, allMap[idx][dbName]) } } reflectValue := reflect.Indirect(reflect.ValueOf(user)) AssertEqual(t, allMap[idx][dbName], reflectValue.FieldByName(name).Interface()) }) } }) } } }) }
explode_data.jsonl/48698
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 2928 }
[ 2830, 3393, 9885, 1155, 353, 8840, 836, 8, 341, 2405, 3847, 284, 3056, 1474, 515, 197, 197, 9, 1949, 1474, 445, 3903, 497, 5532, 6257, 1326, 197, 197, 9, 1949, 1474, 445, 3903, 497, 5532, 6257, 1326, 197, 197, 9, 1949, 1474, 445, ...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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 TestDownloadBodyFail(t *testing.T) { srv, close := mock.NewServer() defer close() srv.SetResponse(mock.WithBodyReadError()) // download policy is automatically added during pipeline construction pl := newTestPipeline(&policy.ClientOptions{ Transport: srv, Retry: policy.RetryOptions{ RetryDelay: 10 * time.Millisecond, }, }) req, err := NewRequest(context.Background(), http.MethodGet, srv.URL()) if err != nil { t.Fatalf("unexpected error: %v", err) } resp, err := pl.Do(req) if err == nil { t.Fatal("unexpected nil error") } payload, err := Payload(resp) if err == nil { t.Fatalf("expected an error") } if payload != nil { t.Fatal("expected nil payload") } }
explode_data.jsonl/6861
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 261 }
[ 2830, 3393, 11377, 5444, 19524, 1155, 353, 8840, 836, 8, 341, 1903, 10553, 11, 3265, 1669, 7860, 7121, 5475, 741, 16867, 3265, 741, 1903, 10553, 4202, 2582, 30389, 26124, 5444, 4418, 1454, 2398, 197, 322, 4139, 4842, 374, 9463, 3694, 23...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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 TestValidateSidecar(t *testing.T) { tests := []struct { name string in *networking.Sidecar valid bool }{ {"empty ingress and egress", &networking.Sidecar{}, false}, {"default", &networking.Sidecar{ Egress: []*networking.IstioEgressListener{ { Hosts: []string{"*/*"}, }, }, }, true}, {"bad egress host 1", &networking.Sidecar{ Egress: []*networking.IstioEgressListener{ { Hosts: []string{"*"}, }, }, }, false}, {"bad egress host 2", &networking.Sidecar{ Egress: []*networking.IstioEgressListener{ { Hosts: []string{"/"}, }, }, }, false}, {"empty egress host", &networking.Sidecar{ Egress: []*networking.IstioEgressListener{ { Hosts: []string{}, }, }, }, false}, {"multiple wildcard egress", &networking.Sidecar{ Egress: []*networking.IstioEgressListener{ { Hosts: []string{ "*/foo.com", }, }, { Hosts: []string{ "ns1/bar.com", }, }, }, }, false}, {"wildcard egress not in end", &networking.Sidecar{ Egress: []*networking.IstioEgressListener{ { Hosts: []string{ "*/foo.com", }, }, { Port: &networking.Port{ Protocol: "http", Number: 8080, Name: "h8080", }, Hosts: []string{ "ns1/bar.com", }, }, }, }, false}, {"invalid Port", &networking.Sidecar{ Egress: []*networking.IstioEgressListener{ { Port: &networking.Port{ Protocol: "http1", Number: 1000000, Name: "", }, Hosts: []string{ "ns1/bar.com", }, }, }, }, false}, {"UDS bind", &networking.Sidecar{ Egress: []*networking.IstioEgressListener{ { Port: &networking.Port{ Protocol: "http", Number: 0, Name: "uds", }, Hosts: []string{ "ns1/bar.com", }, Bind: "unix:///@foo/bar/com", }, }, }, true}, {"UDS bind 2", &networking.Sidecar{ Egress: []*networking.IstioEgressListener{ { Port: &networking.Port{ Protocol: "http", Number: 0, Name: "uds", }, Hosts: []string{ "ns1/bar.com", }, Bind: "unix:///foo/bar/com", }, }, }, true}, {"invalid bind", &networking.Sidecar{ Egress: []*networking.IstioEgressListener{ { Port: &networking.Port{ Protocol: "http", Number: 0, Name: "uds", }, Hosts: []string{ "ns1/bar.com", }, Bind: "foobar:///@foo/bar/com", }, }, }, false}, {"invalid capture mode with uds bind", &networking.Sidecar{ Egress: []*networking.IstioEgressListener{ { Port: &networking.Port{ Protocol: "http", Number: 0, Name: "uds", }, Hosts: []string{ "ns1/bar.com", }, Bind: "unix:///@foo/bar/com", CaptureMode: networking.CaptureMode_IPTABLES, }, }, }, false}, {"duplicate UDS bind", &networking.Sidecar{ Egress: []*networking.IstioEgressListener{ { Port: &networking.Port{ Protocol: "http", Number: 0, Name: "uds", }, Hosts: []string{ "ns1/bar.com", }, Bind: "unix:///@foo/bar/com", }, { Port: &networking.Port{ Protocol: "http", Number: 0, Name: "uds", }, Hosts: []string{ "ns1/bar.com", }, Bind: "unix:///@foo/bar/com", }, }, }, false}, {"duplicate ports", &networking.Sidecar{ Egress: []*networking.IstioEgressListener{ { Port: &networking.Port{ Protocol: "http", Number: 90, Name: "foo", }, Hosts: []string{ "ns1/bar.com", }, }, { Port: &networking.Port{ Protocol: "tcp", Number: 90, Name: "tcp", }, Hosts: []string{ "ns2/bar.com", }, }, }, }, false}, {"ingress without port", &networking.Sidecar{ Ingress: []*networking.IstioIngressListener{ { DefaultEndpoint: "127.0.0.1:110", }, }, }, false}, {"ingress with duplicate ports", &networking.Sidecar{ Ingress: []*networking.IstioIngressListener{ { Port: &networking.Port{ Protocol: "http", Number: 90, Name: "foo", }, DefaultEndpoint: "127.0.0.1:110", }, { Port: &networking.Port{ Protocol: "tcp", Number: 90, Name: "bar", }, DefaultEndpoint: "127.0.0.1:110", }, }, }, false}, {"ingress without default endpoint", &networking.Sidecar{ Ingress: []*networking.IstioIngressListener{ { Port: &networking.Port{ Protocol: "http", Number: 90, Name: "foo", }, }, }, }, false}, {"ingress with invalid default endpoint IP", &networking.Sidecar{ Ingress: []*networking.IstioIngressListener{ { Port: &networking.Port{ Protocol: "http", Number: 90, Name: "foo", }, DefaultEndpoint: "1.1.1.1:90", }, }, }, false}, {"ingress with invalid default endpoint uds", &networking.Sidecar{ Ingress: []*networking.IstioIngressListener{ { Port: &networking.Port{ Protocol: "http", Number: 90, Name: "foo", }, DefaultEndpoint: "unix:///", }, }, }, false}, {"ingress with invalid default endpoint port", &networking.Sidecar{ Ingress: []*networking.IstioIngressListener{ { Port: &networking.Port{ Protocol: "http", Number: 90, Name: "foo", }, DefaultEndpoint: "127.0.0.1:hi", }, }, }, false}, } for _, tt := range tests { t.Run(tt.name, func(t *testing.T) { err := ValidateSidecar("foo", "bar", tt.in) if err == nil && !tt.valid { t.Fatalf("ValidateSidecar(%v) = true, wanted false", tt.in) } else if err != nil && tt.valid { t.Fatalf("ValidateSidecar(%v) = %v, wanted true", tt.in, err) } }) } }
explode_data.jsonl/56936
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 3184 }
[ 2830, 3393, 17926, 16384, 6918, 1155, 353, 8840, 836, 8, 341, 78216, 1669, 3056, 1235, 341, 197, 11609, 220, 914, 198, 197, 17430, 262, 353, 17511, 287, 93135, 6918, 198, 197, 56322, 1807, 198, 197, 59403, 197, 197, 4913, 3194, 78559, ...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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 TestTSNamespaceExports(t *testing.T) { expectPrintedTS(t, ` namespace A { export namespace B { export function fn() {} } namespace C { export function fn() {} } namespace D { function fn() {} } } `, `var A; (function(A) { let B; (function(B) { function fn() { } B.fn = fn; })(B = A.B || (A.B = {})); let C; (function(C) { function fn() { } C.fn = fn; })(C || (C = {})); let D; (function(D) { function fn() { } })(D || (D = {})); })(A || (A = {})); `) expectPrintedTS(t, ` namespace A { export namespace B { export class Class {} } namespace C { export class Class {} } namespace D { class Class {} } } `, `var A; (function(A) { let B; (function(B) { class Class { } B.Class = Class; })(B = A.B || (A.B = {})); let C; (function(C) { class Class { } C.Class = Class; })(C || (C = {})); let D; (function(D) { class Class { } })(D || (D = {})); })(A || (A = {})); `) expectPrintedTS(t, ` namespace A { export namespace B { export enum Enum {} } namespace C { export enum Enum {} } namespace D { enum Enum {} } } `, `var A; (function(A) { let B; (function(B) { let Enum; (function(Enum) { })(Enum = B.Enum || (B.Enum = {})); })(B = A.B || (A.B = {})); let C; (function(C) { let Enum; (function(Enum) { })(Enum = C.Enum || (C.Enum = {})); })(C || (C = {})); let D; (function(D) { let Enum; (function(Enum) { })(Enum || (Enum = {})); })(D || (D = {})); })(A || (A = {})); `) expectPrintedTS(t, ` namespace A { export namespace B { export let foo = 1 foo += foo } namespace C { export let foo = 1 foo += foo } namespace D { let foo = 1 foo += foo } } `, `var A; (function(A) { let B; (function(B) { B.foo = 1; B.foo += B.foo; })(B = A.B || (A.B = {})); let C; (function(C) { C.foo = 1; C.foo += C.foo; })(C || (C = {})); let D; (function(D) { let foo = 1; foo += foo; })(D || (D = {})); })(A || (A = {})); `) expectPrintedTS(t, ` namespace A { export namespace B { export const foo = 1 } namespace C { export const foo = 1 } namespace D { const foo = 1 } } `, `var A; (function(A) { let B; (function(B) { B.foo = 1; })(B = A.B || (A.B = {})); let C; (function(C) { C.foo = 1; })(C || (C = {})); let D; (function(D) { const foo = 1; })(D || (D = {})); })(A || (A = {})); `) expectPrintedTS(t, ` namespace A { export namespace B { export var foo = 1 foo += foo } namespace C { export var foo = 1 foo += foo } namespace D { var foo = 1 foo += foo } } `, `var A; (function(A) { let B; (function(B) { B.foo = 1; B.foo += B.foo; })(B = A.B || (A.B = {})); let C; (function(C) { C.foo = 1; C.foo += C.foo; })(C || (C = {})); let D; (function(D) { var foo = 1; foo += foo; })(D || (D = {})); })(A || (A = {})); `) expectPrintedTS(t, ` namespace ns { export declare const L1 console.log(L1) export declare let [[L2 = x, { [y]: L3 }]] console.log(L2, L3) export declare function F() console.log(F) export declare function F2() { } console.log(F2) export declare class C { } console.log(C) export declare enum E { } console.log(E) export declare namespace N { } console.log(N) } `, `var ns; (function(ns) { console.log(ns.L1); console.log(ns.L2, ns.L3); console.log(F); console.log(F2); console.log(C); console.log(E); console.log(N); })(ns || (ns = {})); `) expectPrintedTS(t, ` namespace a { export var a = 123; log(a) } namespace b { export let b = 123; log(b) } namespace c { export enum c {} log(c) } namespace d { export class d {} log(d) } namespace e { export namespace e {} log(e) } namespace f { export function f() {} log(f) } `, `var a; (function(_a) { _a.a = 123; log(_a.a); })(a || (a = {})); var b; (function(_b) { _b.b = 123; log(_b.b); })(b || (b = {})); var c; (function(_c) { let c; (function(c) { })(c = _c.c || (_c.c = {})); log(c); })(c || (c = {})); var d; (function(_d) { class d { } _d.d = d; log(d); })(d || (d = {})); var e; (function(e) { log(e); })(e || (e = {})); var f; (function(_f) { function f() { } _f.f = f; log(f); })(f || (f = {})); `) }
explode_data.jsonl/82318
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 2256 }
[ 2830, 3393, 9951, 22699, 86994, 1155, 353, 8840, 836, 8, 341, 24952, 8994, 291, 9951, 1155, 11, 22074, 197, 56623, 362, 341, 298, 59440, 4473, 425, 341, 571, 59440, 729, 5168, 368, 5613, 298, 197, 532, 298, 56623, 356, 341, 571, 59440...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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 TestNextMinuteTime(t *testing.T) { nextMinute := nextMinutesTime() minuteElapse := nextMinute.Sub(time.Now()).Minutes() if !almostEqual(minuteElapse, 1.0) { t.Errorf("wrong next one minute. want=%f, got=%f", 1.0, minuteElapse) } }
explode_data.jsonl/1961
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 98 }
[ 2830, 3393, 5847, 55193, 1462, 1155, 353, 8840, 836, 8, 341, 28144, 55193, 1669, 1790, 27720, 1462, 741, 25320, 1070, 6582, 7477, 1669, 1790, 55193, 12391, 9730, 13244, 6011, 27720, 741, 743, 753, 59201, 2993, 14146, 1070, 6582, 7477, 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...
2
func TestDockerKillSuccess(t *testing.T) { composeMock, docker, _ := getComposeMocks() composeMock.On("Down", mock.Anything, mock.Anything, mock.Anything).Return(nil) err := docker.Kill() assert.NoError(t, err) }
explode_data.jsonl/50540
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 79 }
[ 2830, 3393, 35, 13659, 53734, 7188, 1155, 353, 8840, 836, 8, 341, 32810, 2900, 11571, 11, 26588, 11, 716, 1669, 633, 70492, 72577, 741, 32810, 2900, 11571, 8071, 445, 4454, 497, 7860, 13311, 1596, 11, 7860, 13311, 1596, 11, 7860, 13311,...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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 TestAccDataSourceIngestProcessorCSV(t *testing.T) { resource.Test(t, resource.TestCase{ PreCheck: func() { acctest.PreCheck(t) }, ProviderFactories: acctest.Providers, Steps: []resource.TestStep{ { Config: testAccDataSourceIngestProcessorCSV, Check: resource.ComposeTestCheckFunc( resource.TestCheckResourceAttr("data.elasticstack_elasticsearch_ingest_processor_csv.test", "field", "my_field"), CheckResourceJson("data.elasticstack_elasticsearch_ingest_processor_csv.test", "json", expectedJsonCSV), ), }, }, }) }
explode_data.jsonl/69450
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 225 }
[ 2830, 3393, 14603, 17173, 641, 6969, 22946, 44209, 1155, 353, 8840, 836, 8, 341, 50346, 8787, 1155, 11, 5101, 31363, 515, 197, 197, 4703, 3973, 25, 688, 2915, 368, 314, 1613, 67880, 28770, 3973, 1155, 8, 1153, 197, 197, 5179, 17417, 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 TestEntryAddTimed(t *testing.T) { ctrl := gomock.NewController(t) defer ctrl.Finish() e, lists, _ := testEntry(ctrl, testEntryOptions{}) // Add an initial timed metric. require.NoError(t, e.AddTimed(testTimedMetric, testTimedMetadata)) require.Equal(t, 1, len(e.aggregations)) expectedKey := aggregationKey{ aggregationID: testTimedMetadata.AggregationID, storagePolicy: testTimedMetadata.StoragePolicy, idPrefixSuffixType: NoPrefixNoSuffix, } idx := e.aggregations.index(expectedKey) require.True(t, idx >= 0) expectedElem := e.aggregations[idx].elem require.Equal(t, 1, len(lists.lists)) expectedListID := timedMetricListID{ resolution: testTimedMetadata.StoragePolicy.Resolution().Window, }.toMetricListID() res, exists := lists.lists[expectedListID] require.True(t, exists) list := res.(*timedMetricList) require.Equal(t, expectedListID.timed.resolution, list.resolution) require.Equal(t, 1, list.Len()) require.True(t, expectedElem == list.aggregations.Front()) checkElemTombstoned(t, expectedElem.Value.(metricElem), nil) values := expectedElem.Value.(*CounterElem).values require.Equal(t, 1, len(values)) resolution := testTimedMetadata.StoragePolicy.Resolution().Window expectedNanos := xtime.ToUnixNano(time.Unix(0, testTimedMetric.TimeNanos).Truncate(resolution)) v, ok := values[expectedNanos] require.True(t, ok) require.Equal(t, expectedNanos, v.startAt) require.Equal(t, int64(1), v.lockedAgg.aggregation.Count()) require.Equal(t, int64(1000), v.lockedAgg.aggregation.Sum()) require.Equal(t, float64(1000), v.lockedAgg.aggregation.Mean()) // Add the timed metric again with duplicate metadata should not result in an error. require.NoError(t, e.AddTimed(testTimedMetric, testTimedMetadata)) require.Equal(t, 1, len(e.aggregations)) idx = e.aggregations.index(expectedKey) require.True(t, idx >= 0) expectedElem = e.aggregations[idx].elem values = expectedElem.Value.(*CounterElem).values require.Equal(t, 1, len(values)) v, ok = values[expectedNanos] require.True(t, ok) require.Equal(t, int64(2), v.lockedAgg.aggregation.Count()) require.Equal(t, int64(2000), v.lockedAgg.aggregation.Sum()) require.Equal(t, float64(1000), v.lockedAgg.aggregation.Mean()) // Add the timed metric with different timestamp and same metadata. metric := testTimedMetric metric.TimeNanos += testTimedMetadata.StoragePolicy.Resolution().Window.Nanoseconds() require.NoError(t, e.AddTimed(metric, testTimedMetadata)) require.Equal(t, 1, len(e.aggregations)) idx = e.aggregations.index(expectedKey) require.True(t, idx >= 0) expectedElem = e.aggregations[idx].elem values = expectedElem.Value.(*CounterElem).values require.Equal(t, 2, len(values)) expectedNanos = expectedNanos.Add(testTimedMetadata.StoragePolicy.Resolution().Window) v, ok = values[expectedNanos] require.True(t, ok) require.Equal(t, expectedNanos, v.startAt) require.Equal(t, int64(1), v.lockedAgg.aggregation.Count()) require.Equal(t, int64(1000), v.lockedAgg.aggregation.Sum()) // Add the timed metric with a different metadata. metric.ID = make(id.RawID, len(testTimedMetric.ID)) copy(metric.ID, testTimedMetric.ID) metric.TimeNanos += 2 * testTimedMetadata.StoragePolicy.Resolution().Window.Nanoseconds() metadata := testTimedMetadata metadata.StoragePolicy = policy.MustParseStoragePolicy("5m:30d") require.NoError(t, e.AddTimed(metric, metadata)) require.Equal(t, 2, len(e.aggregations)) expectedKeyNew := aggregationKey{ aggregationID: metadata.AggregationID, storagePolicy: metadata.StoragePolicy, idPrefixSuffixType: NoPrefixNoSuffix, } idx = e.aggregations.index(expectedKey) require.True(t, idx >= 0) expectedElem = e.aggregations[idx].elem values = expectedElem.Value.(*CounterElem).values require.Equal(t, 2, len(values)) checkElemTombstoned(t, expectedElem.Value.(metricElem), nil) idx = e.aggregations.index(expectedKeyNew) require.True(t, idx >= 0) expectedElemNew := e.aggregations[idx].elem require.Equal(t, 2, len(lists.lists)) expectedListIDNew := timedMetricListID{ resolution: metadata.StoragePolicy.Resolution().Window, }.toMetricListID() res, exists = lists.lists[expectedListIDNew] require.True(t, exists) listNew := res.(*timedMetricList) require.Equal(t, expectedListIDNew.timed.resolution, listNew.resolution) require.Equal(t, 1, listNew.Len()) require.True(t, expectedElemNew == listNew.aggregations.Front()) counterElem := expectedElemNew.Value.(*CounterElem) values = counterElem.values require.Equal(t, 1, len(values)) resolution = metadata.StoragePolicy.Resolution().Window expectedNanos = xtime.UnixNano(metric.TimeNanos).Truncate(resolution) require.Equal(t, expectedNanos, values[0].startAt) require.Equal(t, int64(1), values[0].lockedAgg.aggregation.Count()) require.Equal(t, int64(1000), values[0].lockedAgg.aggregation.Sum()) require.Equal(t, metric.ID, counterElem.ID()) // Ensure the ID is properly cloned so mutating the ID externally does not mutate the // metric ID stored in the elements. metric.ID[0] = '2' require.Equal(t, testTimedMetric.ID, counterElem.ID()) }
explode_data.jsonl/24237
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 1889 }
[ 2830, 3393, 5874, 2212, 20217, 291, 1155, 353, 8840, 836, 8, 341, 84381, 1669, 342, 316, 1176, 7121, 2051, 1155, 340, 16867, 23743, 991, 18176, 2822, 7727, 11, 11469, 11, 716, 1669, 1273, 5874, 62100, 11, 1273, 5874, 3798, 6257, 692, ...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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 TestProxy(t *testing.T) { // Setup t1 := httptest.NewServer(http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) { fmt.Fprint(w, "target 1") })) defer t1.Close() url1, _ := url.Parse(t1.URL) t2 := httptest.NewServer(http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) { fmt.Fprint(w, "target 2") })) defer t2.Close() url2, _ := url.Parse(t2.URL) targets := []*ProxyTarget{ { Name: "target 1", URL: url1, }, { Name: "target 2", URL: url2, }, } rb := NewRandomBalancer(nil) // must add targets: for _, target := range targets { assert.True(t, rb.AddTarget(target)) } // must ignore duplicates: for _, target := range targets { assert.False(t, rb.AddTarget(target)) } // Random e := echo.New() e.Use(Proxy(rb)) req := httptest.NewRequest(http.MethodGet, "/", nil) rec := httptest.NewRecorder() e.ServeHTTP(rec, req) body := rec.Body.String() expected := map[string]bool{ "target 1": true, "target 2": true, } assert.Condition(t, func() bool { return expected[body] }) for _, target := range targets { assert.True(t, rb.RemoveTarget(target.Name)) } assert.False(t, rb.RemoveTarget("unknown target")) // Round-robin rrb := NewRoundRobinBalancer(targets) e = echo.New() e.Use(Proxy(rrb)) rec = httptest.NewRecorder() e.ServeHTTP(rec, req) body = rec.Body.String() assert.Equal(t, "target 1", body) rec = httptest.NewRecorder() e.ServeHTTP(rec, req) body = rec.Body.String() assert.Equal(t, "target 2", body) // ModifyResponse e = echo.New() e.Use(ProxyWithConfig(ProxyConfig{ Balancer: rrb, ModifyResponse: func(res *http.Response) error { res.Body = ioutil.NopCloser(bytes.NewBuffer([]byte("modified"))) res.Header.Set("X-Modified", "1") return nil }, })) rec = httptest.NewRecorder() e.ServeHTTP(rec, req) assert.Equal(t, "modified", rec.Body.String()) assert.Equal(t, "1", rec.Header().Get("X-Modified")) // ProxyTarget is set in context contextObserver := func(next echo.HandlerFunc) echo.HandlerFunc { return func(c echo.Context) (err error) { next(c) assert.Contains(t, targets, c.Get("target"), "target is not set in context") return nil } } rrb1 := NewRoundRobinBalancer(targets) e = echo.New() e.Use(contextObserver) e.Use(Proxy(rrb1)) rec = httptest.NewRecorder() e.ServeHTTP(rec, req) }
explode_data.jsonl/45582
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 989 }
[ 2830, 3393, 16219, 1155, 353, 8840, 836, 8, 341, 197, 322, 18626, 198, 3244, 16, 1669, 54320, 70334, 7121, 5475, 19886, 89164, 18552, 3622, 1758, 37508, 11, 435, 353, 1254, 9659, 8, 341, 197, 11009, 991, 1350, 3622, 11, 330, 5657, 220...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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 TestTreeLock(t *testing.T) { var path string tree := NewTree() path = "path" err := tree.Lock(path, 1*time.Second) if err != nil { t.Error(err) } path = "path/to/A" err = tree.Lock(path, 1*time.Second) if err != nil { t.Error(err) } }
explode_data.jsonl/73829
{ "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, 6533, 11989, 1155, 353, 8840, 836, 8, 1476, 2405, 1815, 914, 198, 51968, 1669, 1532, 6533, 2822, 26781, 284, 330, 2343, 1837, 9859, 1669, 4916, 31403, 5581, 11, 220, 16, 77053, 32435, 692, 743, 1848, 961, 2092, 341, 197, 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...
3
func TestPostEvents(t *testing.T) { t.Run("Post event deploy without and with authorization", func(t *testing.T) { //r := BuildEngine() // Create a request to send to the above route req, _ := http.NewRequest("POST", "/events", nil) testHTTPResponse(t, r, req, func(w *httptest.ResponseRecorder) bool { // Test that the http status code is 401 because of missing authentication statusOK := w.Code == http.StatusUnauthorized return statusOK }) message := map[string]interface{}{ "type": entities.EVENT_COMMIT, "status": entities.STATUS_SUCCESS, "commit_id": uuid.New().String(), "pipeline_id": PIPELINE_ID, "environment": ENVIRONMENT, "timestamp": time.Now().Unix(), } bytesRepresentation, _ := json.Marshal(message) body := bytes.NewBuffer(bytesRepresentation) req, _ = http.NewRequest("POST", "/events", body) req.Header.Set("Content-Type", "application/json") authenticate(req) testHTTPResponse(t, r, req, func(w *httptest.ResponseRecorder) bool { // Test that the http status code is 200 statusOK := w.Code == http.StatusOK var pageOK bool if statusOK { var result representations.Commit err := json.NewDecoder(w.Body).Decode(&result) pageOK = err == nil && result.Id != "" } return statusOK && pageOK }) }) t.Run("Post event committed and approve", func(t *testing.T) { message := map[string]interface{}{ "type": entities.EVENT_COMMIT, "status": entities.STATUS_SUCCESS, "commit_id": uuid.New().String(), "pipeline_id": PIPELINE_ID, "environment": ENVIRONMENT, "timestamp": time.Now().Add(-5 * time.Minute).Unix(), //.Format(time.RFC3339), } message["commit_id"] = uuid.New().String() postEvent(t, "header", message) message["type"] = "approve" message["timestamp"] = time.Now().Unix() //.Format(time.RFC3339) event, err := postEvent(t, "header", message) assert.Nil(t, err, "no error") assert.True(t, event.Type == entities.EVENT_APPROVE, "approve event") }) t.Run("Post event incident status change", func(t *testing.T) { message := map[string]interface{}{ "type": entities.EVENT_INCIDENT_STATUS_CHANGE, "status": entities.STATUS_FAILURE, "incident_id": uuid.New().String(), "pipeline_id": PIPELINE_ID, "environment": ENVIRONMENT, "timestamp": time.Now().Add(-5 * time.Minute).Unix(), //.Format(time.RFC3339), } message["commit_id"] = uuid.New().String() event, err := postEvent(t, "header", message) assert.Nil(t, err, "no error") assert.True(t, event.Type == entities.EVENT_INCIDENT_STATUS_CHANGE, "incident event") message["type"] = entities.EVENT_INCIDENT_STATUS_CHANGE message["status"] = entities.STATUS_SUCCESS message["timestamp"] = time.Now().Unix() //.Format(time.RFC3339) event, err = postEvent(t, "header", message) assert.Nil(t, err, "no error") assert.True(t, event.Type == entities.EVENT_INCIDENT_STATUS_CHANGE, "incident event") }) t.Run("Post event deploy", func(t *testing.T) { message := map[string]interface{}{ "type": entities.EVENT_COMMIT, "status": entities.STATUS_SUCCESS, "commit_id": uuid.New().String(), "pipeline_id": PIPELINE_ID, "environment": ENVIRONMENT, "timestamp": time.Now().Add(-20 * time.Minute).Unix(), //.Format(time.RFC3339), } event, err := postEvent(t, "header", message) message["timestamp"] = time.Now().Add(-10 * time.Minute).Unix() message["type"] = entities.EVENT_DEPLOY event, err = postEvent(t, "header", message) assert.Nil(t, err, "no error") assert.True(t, event.Type == entities.EVENT_DEPLOY, "deploy event") message["timestamp"] = time.Now().Add(-2 * time.Minute).Unix() //.Format(time.RFC3339) event, err = postEvent(t, "header", message) assert.True(t, event.Type == entities.EVENT_DEPLOY, "deploy event") message["timestamp"] = time.Now().Unix() //.Format(time.RFC3339) message["status"] = entities.STATUS_SUCCESS event, err = postEvent(t, "header", message) assert.True(t, event.Type == entities.EVENT_DEPLOY, "deploy event") }) }
explode_data.jsonl/4637
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 1619 }
[ 2830, 3393, 4133, 7900, 1155, 353, 8840, 836, 8, 1476, 3244, 16708, 445, 4133, 1538, 10517, 2041, 323, 448, 23715, 497, 2915, 1155, 353, 8840, 836, 8, 1476, 197, 197, 322, 81, 1669, 7854, 4571, 2822, 197, 197, 322, 4230, 264, 1681, ...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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 TestBuilderBuild(t *testing.T) { testCases := []struct { desc string middlewares []string // buildResponse is needed because secure use a private context key buildResponse func(map[string]*dynamic.Middleware) *http.Response conf map[string]*dynamic.Middleware assertResponse func(*testing.T, *http.Response) }{ { desc: "no configuration", middlewares: []string{"foo", "bar"}, buildResponse: stubResponse, conf: map[string]*dynamic.Middleware{}, assertResponse: func(t *testing.T, resp *http.Response) {}, }, { desc: "one modifier", middlewares: []string{"foo", "bar"}, buildResponse: stubResponse, conf: map[string]*dynamic.Middleware{ "foo": { Headers: &dynamic.Headers{ CustomResponseHeaders: map[string]string{"X-Foo": "foo"}, }, }, }, assertResponse: func(t *testing.T, resp *http.Response) { t.Helper() assert.Equal(t, "foo", resp.Header.Get("X-Foo")) }, }, { desc: "secure: one modifier", middlewares: []string{"foo", "bar"}, buildResponse: func(middlewares map[string]*dynamic.Middleware) *http.Response { ctx := context.Background() var request *http.Request next := http.HandlerFunc(func(rw http.ResponseWriter, req *http.Request) { request = req }) headerM := *middlewares["foo"].Headers handler, err := headers.New(ctx, next, headerM, "foo") require.NoError(t, err) handler.ServeHTTP(httptest.NewRecorder(), httptest.NewRequest(http.MethodGet, "http://foo.com", nil)) return &http.Response{Header: make(http.Header), Request: request} }, conf: map[string]*dynamic.Middleware{ "foo": { Headers: &dynamic.Headers{ ReferrerPolicy: "no-referrer", }, }, "bar": { Headers: &dynamic.Headers{ CustomResponseHeaders: map[string]string{"X-Bar": "bar"}, }, }, }, assertResponse: func(t *testing.T, resp *http.Response) { t.Helper() assert.Equal(t, "no-referrer", resp.Header.Get("Referrer-Policy")) }, }, { desc: "two modifiers", middlewares: []string{"foo", "bar"}, buildResponse: stubResponse, conf: map[string]*dynamic.Middleware{ "foo": { Headers: &dynamic.Headers{ CustomResponseHeaders: map[string]string{"X-Foo": "foo"}, }, }, "bar": { Headers: &dynamic.Headers{ CustomResponseHeaders: map[string]string{"X-Bar": "bar"}, }, }, }, assertResponse: func(t *testing.T, resp *http.Response) { t.Helper() assert.Equal(t, "foo", resp.Header.Get("X-Foo")) assert.Equal(t, "bar", resp.Header.Get("X-Bar")) }, }, { desc: "modifier order", middlewares: []string{"foo", "bar"}, buildResponse: stubResponse, conf: map[string]*dynamic.Middleware{ "foo": { Headers: &dynamic.Headers{ CustomResponseHeaders: map[string]string{"X-Foo": "foo"}, }, }, "bar": { Headers: &dynamic.Headers{ CustomResponseHeaders: map[string]string{"X-Foo": "bar"}, }, }, }, assertResponse: func(t *testing.T, resp *http.Response) { t.Helper() assert.Equal(t, "foo", resp.Header.Get("X-Foo")) }, }, { desc: "chain", middlewares: []string{"chain"}, buildResponse: stubResponse, conf: map[string]*dynamic.Middleware{ "foo": { Headers: &dynamic.Headers{ CustomResponseHeaders: map[string]string{"X-Foo": "foo"}, }, }, "bar": { Headers: &dynamic.Headers{ CustomResponseHeaders: map[string]string{"X-Foo": "bar"}, }, }, "chain": { Chain: &dynamic.Chain{ Middlewares: []string{"foo", "bar"}, }, }, }, assertResponse: func(t *testing.T, resp *http.Response) { t.Helper() assert.Equal(t, "foo", resp.Header.Get("X-Foo")) }, }, { desc: "nil middleware", middlewares: []string{"foo"}, buildResponse: stubResponse, conf: map[string]*dynamic.Middleware{ "foo": nil, }, assertResponse: func(t *testing.T, resp *http.Response) {}, }, { desc: "chain without headers", middlewares: []string{"chain"}, buildResponse: stubResponse, conf: map[string]*dynamic.Middleware{ "foo": {IPWhiteList: &dynamic.IPWhiteList{}}, "chain": { Chain: &dynamic.Chain{ Middlewares: []string{"foo"}, }, }, }, assertResponse: func(t *testing.T, resp *http.Response) {}, }, } for _, test := range testCases { test := test t.Run(test.desc, func(t *testing.T) { t.Parallel() rtConf := runtime.NewConfig(dynamic.Configuration{ HTTP: &dynamic.HTTPConfiguration{ Middlewares: test.conf, }, }) builder := NewBuilder(rtConf.Middlewares) rm := builder.Build(context.Background(), test.middlewares) if rm == nil { return } resp := test.buildResponse(test.conf) err := rm(resp) require.NoError(t, err) test.assertResponse(t, resp) }) } }
explode_data.jsonl/13347
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 2286 }
[ 2830, 3393, 3297, 11066, 1155, 353, 8840, 836, 8, 341, 18185, 37302, 1669, 3056, 1235, 341, 197, 41653, 286, 914, 198, 197, 2109, 3310, 37903, 3056, 917, 198, 197, 197, 322, 1936, 2582, 374, 4362, 1576, 9767, 990, 264, 869, 2266, 1376...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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 TestCRLCreation(t *testing.T) { block, _ := pem.Decode([]byte(pemPrivateKey)) priv, _ := ParsePKCS1PrivateKey(block.Bytes) block, _ = pem.Decode([]byte(pemCertificate)) cert, _ := ParseCertificate(block.Bytes) loc := time.FixedZone("Oz/Atlantis", int((2 * time.Hour).Seconds())) now := time.Unix(1000, 0).In(loc) nowUTC := now.UTC() expiry := time.Unix(10000, 0) revokedCerts := []pkix.RevokedCertificate{ { SerialNumber: big.NewInt(1), RevocationTime: nowUTC, }, { SerialNumber: big.NewInt(42), // RevocationTime should be converted to UTC before marshaling. RevocationTime: now, }, } expectedCerts := []pkix.RevokedCertificate{ { SerialNumber: big.NewInt(1), RevocationTime: nowUTC, }, { SerialNumber: big.NewInt(42), RevocationTime: nowUTC, }, } crlBytes, err := cert.CreateCRL(rand.Reader, priv, revokedCerts, now, expiry) if err != nil { t.Errorf("error creating CRL: %s", err) } parsedCRL, err := ParseDERCRL(crlBytes) if err != nil { t.Errorf("error reparsing CRL: %s", err) } if !reflect.DeepEqual(parsedCRL.TBSCertList.RevokedCertificates, expectedCerts) { t.Errorf("RevokedCertificates mismatch: got %v; want %v.", parsedCRL.TBSCertList.RevokedCertificates, expectedCerts) } }
explode_data.jsonl/67992
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 538 }
[ 2830, 3393, 34, 4728, 32701, 1155, 353, 8840, 836, 8, 341, 47996, 11, 716, 1669, 54184, 56372, 10556, 3782, 1295, 336, 75981, 1171, 71170, 11, 716, 1669, 14775, 22242, 6412, 16, 75981, 18682, 36868, 340, 47996, 11, 716, 284, 54184, 5637...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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 TestFunction1(t *testing.T) { const SCRIPT = ` var f = function f1(count) { if (count == 0) { return true; } return f1(count-1); } f(1); ` testScript1(SCRIPT, valueTrue, t) }
explode_data.jsonl/75282
{ "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, 5152, 16, 1155, 353, 8840, 836, 8, 341, 4777, 53679, 284, 1565, 271, 2405, 282, 284, 729, 282, 16, 11512, 8, 341, 197, 743, 320, 1830, 621, 220, 15, 8, 341, 298, 853, 830, 280, 197, 197, 532, 197, 853, 282, 16, 11512...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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 TestCmdInvalidDiffType(t *testing.T) { runner := cmddiff.NewRunner(fake.CtxWithDefaultPrinter(), "") runner.C.SetArgs([]string{"--diff-type", "invalid"}) err := runner.C.Execute() assert.EqualError(t, err, "invalid diff-type 'invalid': supported diff-types are: local, remote, combined, 3way") }
explode_data.jsonl/1847
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 114 }
[ 2830, 3393, 15613, 7928, 21751, 929, 1155, 353, 8840, 836, 8, 341, 197, 41736, 1669, 9961, 631, 3092, 7121, 19486, 74138, 727, 3998, 2354, 3675, 45660, 1507, 14676, 197, 41736, 727, 4202, 4117, 10556, 917, 4913, 313, 13490, 10604, 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 TestNewResourceFromFilename(t *testing.T) { c := qt.New(t) spec := newTestResourceSpec(specDescriptor{c: c}) writeSource(t, spec.Fs, "content/a/b/logo.png", "image") writeSource(t, spec.Fs, "content/a/b/data.json", "json") bfs := afero.NewBasePathFs(spec.Fs.Source, "content") r, err := spec.New(ResourceSourceDescriptor{Fs: bfs, SourceFilename: "a/b/logo.png"}) c.Assert(err, qt.IsNil) c.Assert(r, qt.Not(qt.IsNil)) c.Assert(r.ResourceType(), qt.Equals, "image") c.Assert(r.RelPermalink(), qt.Equals, "/a/b/logo.png") c.Assert(r.Permalink(), qt.Equals, "https://example.com/a/b/logo.png") r, err = spec.New(ResourceSourceDescriptor{Fs: bfs, SourceFilename: "a/b/data.json"}) c.Assert(err, qt.IsNil) c.Assert(r, qt.Not(qt.IsNil)) c.Assert(r.ResourceType(), qt.Equals, "application") }
explode_data.jsonl/75610
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 365 }
[ 2830, 3393, 3564, 4783, 3830, 20759, 1155, 353, 8840, 836, 8, 341, 1444, 1669, 38949, 7121, 1155, 340, 98100, 1669, 501, 2271, 4783, 8327, 38209, 11709, 90, 66, 25, 272, 8824, 24945, 3608, 1155, 11, 1398, 991, 82, 11, 330, 1796, 14186...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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 TestListenNotifyWhileBusyIsSafe(t *testing.T) { t.Parallel() func() { conn := mustConnectString(t, os.Getenv("PGX_TEST_DATABASE")) defer closeConn(t, conn) skipCockroachDB(t, conn, "Server does not support LISTEN / NOTIFY (https://github.com/cockroachdb/cockroach/issues/41522)") }() listenerDone := make(chan bool) notifierDone := make(chan bool) go func() { conn := mustConnectString(t, os.Getenv("PGX_TEST_DATABASE")) defer closeConn(t, conn) defer func() { listenerDone <- true }() mustExec(t, conn, "listen busysafe") for i := 0; i < 5000; i++ { var sum int32 var rowCount int32 rows, err := conn.Query(context.Background(), "select generate_series(1,$1)", 100) if err != nil { t.Errorf("conn.Query failed: %v", err) return } for rows.Next() { var n int32 if err := rows.Scan(&n); err != nil { t.Errorf("Row scan failed: %v", err) return } sum += n rowCount++ } if rows.Err() != nil { t.Errorf("conn.Query failed: %v", err) return } if sum != 5050 { t.Errorf("Wrong rows sum: %v", sum) return } if rowCount != 100 { t.Errorf("Wrong number of rows: %v", rowCount) return } time.Sleep(1 * time.Microsecond) } }() go func() { conn := mustConnectString(t, os.Getenv("PGX_TEST_DATABASE")) defer closeConn(t, conn) defer func() { notifierDone <- true }() for i := 0; i < 100000; i++ { mustExec(t, conn, "notify busysafe, 'hello'") time.Sleep(1 * time.Microsecond) } }() <-listenerDone <-notifierDone }
explode_data.jsonl/40017
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 710 }
[ 2830, 3393, 38714, 28962, 7983, 58937, 3872, 25663, 1155, 353, 8840, 836, 8, 341, 3244, 41288, 7957, 2822, 29244, 368, 341, 197, 32917, 1669, 1969, 14611, 703, 1155, 11, 2643, 64883, 445, 11383, 55, 11641, 45510, 5455, 197, 16867, 3265, ...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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 TestJsonpbUTF8Tx(t *testing.T) { NewChain33Config(GetDefaultCfgstring()) bdata, err := common.FromHex("0a05636f696e73121018010a0c108084af5f1a05310a320a3320e8b31b30b9b69483d7f9d3f04c3a22314b67453376617969715a4b6866684d66744e3776743267447639486f4d6b393431") assert.Nil(t, err) var r Transaction err = Decode(bdata, &r) assert.Nil(t, err) plType := LoadExecutorType("coins") var pl Message if plType != nil { pl, err = plType.DecodePayload(&r) if err != nil { pl = nil } } var pljson json.RawMessage assert.NotNil(t, pl) pljson, err = PBToJSONUTF8(pl) assert.Nil(t, err) assert.Equal(t, string(pljson), `{"transfer":{"cointoken":"","amount":"200000000","note":"1\n2\n3","to":""},"ty":1}`) }
explode_data.jsonl/58330
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 330 }
[ 2830, 3393, 5014, 16650, 8561, 23, 31584, 1155, 353, 8840, 836, 8, 341, 197, 3564, 18837, 18, 18, 2648, 24460, 3675, 42467, 917, 2398, 2233, 691, 11, 1848, 1669, 4185, 11439, 20335, 445, 15, 64, 15, 20, 21, 18, 21, 69, 21, 24, 21,...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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 TestReconcileAddonsConfiguration_DeleteAddonsProcess_ReconcileOtherAddons(t *testing.T) { // GIVEN failedAddCfg := fixFailedAddonsConfiguration() fixAddonsCfg := fixDeletedAddonsConfiguration() ts := getTestSuite(t, fixAddonsCfg, failedAddCfg) tmpDir := os.TempDir() defer ts.assertExpectations() // WHEN reconciler := NewReconcileAddonsConfiguration(ts.mgr, ts.addonGetterFactory, ts.chartStorage, ts.addonStorage, ts.brokerFacade, ts.docsProvider, ts.brokerSyncer, ts.templateService, tmpDir, time.Second, spy.NewLogDummy()) // THEN result, err := reconciler.Reconcile(reconcile.Request{NamespacedName: types.NamespacedName{Namespace: fixAddonsCfg.Namespace, Name: fixAddonsCfg.Name}}) assert.NoError(t, err) assert.False(t, result.Requeue) otherAddon := v1alpha1.AddonsConfiguration{} err = ts.mgr.GetClient().Get(context.Background(), types.NamespacedName{Namespace: failedAddCfg.Namespace, Name: failedAddCfg.Name}, &otherAddon) assert.NoError(t, err) assert.Equal(t, int(otherAddon.Spec.ReprocessRequest), 1) res := v1alpha1.AddonsConfiguration{} err = ts.mgr.GetClient().Get(context.Background(), types.NamespacedName{Namespace: fixAddonsCfg.Namespace, Name: fixAddonsCfg.Name}, &res) assert.NoError(t, err) assert.NotContains(t, res.Finalizers, v1alpha1.FinalizerAddonsConfiguration) }
explode_data.jsonl/40352
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 475 }
[ 2830, 3393, 693, 40446, 457, 2212, 2382, 7688, 57418, 2212, 2382, 7423, 50693, 40446, 457, 11409, 2212, 2382, 1155, 353, 8840, 836, 8, 341, 197, 322, 89836, 198, 1166, 5687, 2212, 42467, 1669, 5046, 9408, 2212, 2382, 7688, 741, 1166, 94...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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 TestUUIDVersion4(t *testing.T) { uuid := protocol.UUIDVersion4(make([]byte, 16)) if e, a := `00000000-0000-4000-8000-000000000000`, uuid; e != a { t.Errorf("expect %v, got %v", e, a) } b := make([]byte, 16) for i := 0; i < len(b); i++ { b[i] = 1 } uuid = protocol.UUIDVersion4(b) if e, a := `01010101-0101-4101-8101-010101010101`, uuid; e != a { t.Errorf("expect %v, got %v", e, a) } }
explode_data.jsonl/78827
{ "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, 24754, 5637, 19, 1155, 353, 8840, 836, 8, 341, 10676, 2423, 1669, 11507, 39636, 5637, 19, 36944, 10556, 3782, 11, 220, 16, 21, 1171, 743, 384, 11, 264, 1669, 1565, 15, 15, 15, 15, 15, 15, 15, 15, 12, 15, 15, 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...
4
func TestKetama(t *testing.T) { k := New(WithReplicas(7), WithGoroutineSafe()) k.Add("1.1.1.1", "2.2.2.2", "3.3.3.3") for i := 0; i < 10; i++ { node, ok := k.Get(strconv.Itoa(i)) t.Logf("%v : %v %v", i, node, ok) } t.Logf("========================") k.Remove("1.1.1.1") for i := 0; i < 10; i++ { node, ok := k.Get(strconv.Itoa(i)) t.Logf("%v : %v %v", i, node, ok) } t.Logf("========================") k.Add("4.4.4.4") for i := 0; i < 10; i++ { node, ok := k.Get(strconv.Itoa(i)) t.Logf("%v : %v %v", i, node, ok) } }
explode_data.jsonl/53336
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 287 }
[ 2830, 3393, 42, 295, 3029, 1155, 353, 8840, 836, 8, 341, 16463, 1669, 1532, 7, 2354, 18327, 52210, 7, 22, 701, 3085, 38, 269, 14159, 25663, 2398, 16463, 1904, 445, 16, 13, 16, 13, 16, 13, 16, 497, 330, 17, 13, 17, 13, 17, 13, ...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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 TestFilesetStructuralValidatorNotFileset(t *testing.T) { validator := NewFilesetStructuralValidator(newMockRepository(nil)) err := validator.ValidateResource(testResource("bs646cd8717.json")) assert.Nil(t, err) }
explode_data.jsonl/16714
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 75 }
[ 2830, 3393, 1703, 746, 9422, 4176, 14256, 2623, 1703, 746, 1155, 353, 8840, 836, 8, 341, 197, 16112, 1669, 1532, 1703, 746, 9422, 4176, 14256, 1755, 11571, 4624, 27907, 1171, 9859, 1669, 22935, 47667, 4783, 8623, 4783, 445, 1279, 21, 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
func TestDecodeValueSuccess(t *testing.T) { for _, d := range []struct { n string b []byte t SQLValueType v TypedValue offs int }{ { "varchar", []byte{0, 0, 0, 2, 'H', 'i'}, VarcharType, &Varchar{val: "Hi"}, 6, }, { "varchar padded", []byte{0, 0, 0, 2, 'H', 'i', 1, 2, 3}, VarcharType, &Varchar{val: "Hi"}, 6, }, { "empty varchar", []byte{0, 0, 0, 0}, VarcharType, &Varchar{val: ""}, 4, }, { "zero integer", []byte{0, 0, 0, 8, 0, 0, 0, 0, 0, 0, 0, 0}, IntegerType, &Number{val: 0}, 12, }, { "large integer", []byte{0, 0, 0, 8, 0, 0, 0, 0, 127, 255, 255, 255}, IntegerType, &Number{val: math.MaxInt32}, 12, }, { "large integer padded", []byte{0, 0, 0, 8, 0, 0, 0, 0, 127, 255, 255, 255, 1, 1, 1}, IntegerType, &Number{val: math.MaxInt32}, 12, }, { "boolean false", []byte{0, 0, 0, 1, 0}, BooleanType, &Bool{val: false}, 5, }, { "boolean true", []byte{0, 0, 0, 1, 1}, BooleanType, &Bool{val: true}, 5, }, { "boolean padded", []byte{0, 0, 0, 1, 0, 1}, BooleanType, &Bool{val: false}, 5, }, { "blob", []byte{0, 0, 0, 2, 'H', 'i'}, BLOBType, &Blob{val: []byte{'H', 'i'}}, 6, }, { "blob padded", []byte{0, 0, 0, 2, 'H', 'i', 1, 2, 3}, BLOBType, &Blob{val: []byte{'H', 'i'}}, 6, }, { "empty blob", []byte{0, 0, 0, 0}, BLOBType, &Blob{val: []byte{}}, 4, }, } { t.Run(d.n, func(t *testing.T) { v, offs, err := DecodeValue(d.b, d.t) require.NoError(t, err) require.EqualValues(t, d.offs, offs) cmp, err := d.v.Compare(v) require.NoError(t, err) require.Zero(t, cmp) }) } }
explode_data.jsonl/64090
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 1016 }
[ 2830, 3393, 32564, 1130, 7188, 1155, 353, 8840, 836, 8, 341, 2023, 8358, 294, 1669, 2088, 3056, 1235, 341, 197, 9038, 914, 198, 197, 2233, 3056, 3782, 198, 197, 3244, 7870, 60897, 271, 197, 5195, 262, 50554, 1130, 198, 197, 197, 32483...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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 TestTransportRequestsStallAtServerLimit(t *testing.T) { const maxConcurrent = 2 greet := make(chan struct{}) // server sends initial SETTINGS frame gotRequest := make(chan struct{}) // server received a request clientDone := make(chan struct{}) // Collect errors from goroutines. var wg sync.WaitGroup errs := make(chan error, 100) defer func() { wg.Wait() close(errs) for err := range errs { t.Error(err) } }() // We will send maxConcurrent+2 requests. This checker goroutine waits for the // following stages: // 1. The first maxConcurrent requests are received by the server. // 2. The client will cancel the next request // 3. The server is unblocked so it can service the first maxConcurrent requests // 4. The client will send the final request wg.Add(1) unblockClient := make(chan struct{}) clientRequestCancelled := make(chan struct{}) unblockServer := make(chan struct{}) go func() { defer wg.Done() // Stage 1. for k := 0; k < maxConcurrent; k++ { <-gotRequest } // Stage 2. close(unblockClient) <-clientRequestCancelled // Stage 3: give some time for the final RoundTrip call to be scheduled and // verify that the final request is not sent. time.Sleep(50 * time.Millisecond) select { case <-gotRequest: errs <- errors.New("last request did not stall") close(unblockServer) return default: } close(unblockServer) // Stage 4. <-gotRequest }() ct := newClientTester(t) ct.tr.StrictMaxConcurrentStreams = true ct.client = func() error { var wg sync.WaitGroup defer func() { wg.Wait() close(clientDone) ct.cc.(*net.TCPConn).CloseWrite() }() for k := 0; k < maxConcurrent+2; k++ { wg.Add(1) go func(k int) { defer wg.Done() // Don't send the second request until after receiving SETTINGS from the server // to avoid a race where we use the default SettingMaxConcurrentStreams, which // is much larger than maxConcurrent. We have to send the first request before // waiting because the first request triggers the dial and greet. if k > 0 { <-greet } // Block until maxConcurrent requests are sent before sending any more. if k >= maxConcurrent { <-unblockClient } req, _ := http.NewRequest("GET", fmt.Sprintf("https://dummy.tld/%d", k), nil) if k == maxConcurrent { // This request will be canceled. cancel := make(chan struct{}) req.Cancel = cancel close(cancel) _, err := ct.tr.RoundTrip(req) close(clientRequestCancelled) if err == nil { errs <- fmt.Errorf("RoundTrip(%d) should have failed due to cancel", k) return } } else { resp, err := ct.tr.RoundTrip(req) if err != nil { errs <- fmt.Errorf("RoundTrip(%d): %v", k, err) return } ioutil.ReadAll(resp.Body) resp.Body.Close() if resp.StatusCode != 204 { errs <- fmt.Errorf("Status = %v; want 204", resp.StatusCode) return } } }(k) } return nil } ct.server = func() error { var wg sync.WaitGroup defer wg.Wait() ct.greet(Setting{SettingMaxConcurrentStreams, maxConcurrent}) // Server write loop. var buf bytes.Buffer enc := hpack.NewEncoder(&buf) writeResp := make(chan uint32, maxConcurrent+1) wg.Add(1) go func() { defer wg.Done() <-unblockServer for id := range writeResp { buf.Reset() enc.WriteField(hpack.HeaderField{Name: ":status", Value: "204"}) ct.fr.WriteHeaders(HeadersFrameParam{ StreamID: id, EndHeaders: true, EndStream: true, BlockFragment: buf.Bytes(), }) } }() // Server read loop. var nreq int for { f, err := ct.fr.ReadFrame() if err != nil { select { case <-clientDone: // If the client's done, it will have reported any errors on its side. return nil default: return err } } switch f := f.(type) { case *WindowUpdateFrame: case *SettingsFrame: // Wait for the client SETTINGS ack until ending the greet. close(greet) case *HeadersFrame: if !f.HeadersEnded() { return fmt.Errorf("headers should have END_HEADERS be ended: %v", f) } gotRequest <- struct{}{} nreq++ writeResp <- f.StreamID if nreq == maxConcurrent+1 { close(writeResp) } default: return fmt.Errorf("Unexpected client frame %v", f) } } } ct.run() }
explode_data.jsonl/16141
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 1831 }
[ 2830, 3393, 27560, 35295, 623, 541, 1655, 5475, 16527, 1155, 353, 8840, 836, 8, 341, 4777, 1932, 1109, 3231, 284, 220, 17, 271, 3174, 3744, 1669, 1281, 35190, 2036, 28875, 414, 442, 3538, 21308, 2856, 73991, 4034, 198, 3174, 354, 1900, ...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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 TestUtil_Format_MoreArgs(t *testing.T) { vm := goja.New() util := New(vm) var b bytes.Buffer util.Format(&b, "Test: %s %d, %j", vm.ToValue("string"), vm.ToValue(42), vm.NewObject(), vm.ToValue(42.42)) if res := b.String(); res != "Test: string 42, {} 42.42" { t.Fatalf("Unexpected result: '%s'", res) } }
explode_data.jsonl/60332
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 135 }
[ 2830, 3393, 2742, 72999, 1245, 460, 4117, 1155, 353, 8840, 836, 8, 341, 54879, 1669, 728, 5580, 7121, 741, 79138, 1669, 1532, 31723, 692, 2405, 293, 5820, 22622, 198, 79138, 9978, 2099, 65, 11, 330, 2271, 25, 1018, 82, 1018, 67, 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...
2
func TestMarkEndRequiresAllTasksToFinishToUpdateBuildStatus(t *testing.T) { assert := assert.New(t) require := require.New(t) require.NoError(db.ClearCollections(task.Collection, build.Collection, VersionCollection, event.AllLogCollection)) v := &Version{ Id: "sample_version", Identifier: "sample", Requester: evergreen.RepotrackerVersionRequester, Config: "identifier: sample", Status: evergreen.VersionStarted, } require.NoError(v.Insert()) buildID := "buildtest" testTask := &task.Task{ Id: "testone", DisplayName: "test 1", Activated: false, BuildId: buildID, Project: "sample", Status: evergreen.TaskStarted, StartTime: time.Now().Add(-time.Hour), Version: v.Id, } assert.NoError(testTask.Insert()) anotherTask := &task.Task{ Id: "two", DisplayName: "test 2", Activated: true, BuildId: buildID, Project: "sample", Status: evergreen.TaskStarted, StartTime: time.Now().Add(-time.Hour), Version: v.Id, } assert.NoError(anotherTask.Insert()) displayTask := &task.Task{ Id: "three", DisplayName: "display task", Activated: true, DisplayOnly: true, BuildId: buildID, Project: "sample", Status: evergreen.TaskStarted, StartTime: time.Now().Add(-time.Hour), ExecutionTasks: []string{"exe0", "exe1"}, Version: v.Id, } assert.NoError(displayTask.Insert()) exeTask0 := &task.Task{ Id: "exe0", DisplayName: "execution 0", Activated: true, BuildId: buildID, Project: "sample", Status: evergreen.TaskStarted, StartTime: time.Now().Add(-time.Hour), Version: v.Id, } assert.True(exeTask0.IsPartOfDisplay()) assert.NoError(exeTask0.Insert()) exeTask1 := &task.Task{ Id: "exe1", DisplayName: "execution 1", Activated: true, BuildId: buildID, Project: "sample", Status: evergreen.TaskStarted, StartTime: time.Now().Add(-time.Hour), Version: v.Id, } assert.True(exeTask1.IsPartOfDisplay()) assert.NoError(exeTask1.Insert()) b := &build.Build{ Id: buildID, Status: evergreen.BuildStarted, Activated: true, Version: v.Id, Tasks: []build.TaskCache{ { Id: testTask.Id, Status: evergreen.TaskStarted, Activated: true, }, { Id: anotherTask.Id, Status: evergreen.TaskStarted, Activated: true, }, { Id: displayTask.Id, Status: evergreen.TaskStarted, Activated: true, }, }, } require.NoError(b.Insert()) assert.False(b.IsFinished()) details := &apimodels.TaskEndDetail{ Status: evergreen.TaskFailed, Type: evergreen.CommandTypeSystem, } updates := StatusChanges{} assert.NoError(MarkEnd(testTask, "", time.Now(), details, false, &updates)) assert.Empty(updates.BuildNewStatus) assert.False(updates.BuildComplete) assert.Empty(updates.VersionNewStatus) assert.False(updates.VersionComplete) b, err := build.FindOneId(buildID) assert.NoError(err) tasks, err := task.Find(task.ByVersion(b.Version).WithFields(task.BuildIdKey, task.StatusKey, task.ActivatedKey, task.DependsOnKey)) require.NoError(err) complete, _, err := b.AllUnblockedTasksFinished(tasks) assert.NoError(err) assert.False(complete) updates = StatusChanges{} assert.NoError(MarkEnd(anotherTask, "", time.Now(), details, false, &updates)) assert.Empty(updates.BuildNewStatus) assert.False(updates.BuildComplete) assert.Empty(updates.VersionNewStatus) assert.False(updates.VersionComplete) b, err = build.FindOneId(buildID) assert.NoError(err) tasks, err = task.Find(task.ByVersion(b.Version).WithFields(task.BuildIdKey, task.StatusKey, task.ActivatedKey, task.DependsOnKey)) require.NoError(err) complete, _, err = b.AllUnblockedTasksFinished(tasks) assert.NoError(err) assert.False(complete) updates = StatusChanges{} assert.NoError(MarkEnd(exeTask0, "", time.Now(), details, false, &updates)) assert.Empty(updates.BuildNewStatus) assert.False(updates.BuildComplete) assert.Empty(updates.VersionNewStatus) assert.False(updates.VersionComplete) b, err = build.FindOneId(buildID) assert.NoError(err) tasks, err = task.Find(task.ByVersion(b.Version).WithFields(task.BuildIdKey, task.StatusKey, task.ActivatedKey, task.DependsOnKey)) require.NoError(err) complete, _, err = b.AllUnblockedTasksFinished(tasks) assert.NoError(err) assert.False(complete) exeTask1.DisplayTask = nil assert.NoError(err) updates = StatusChanges{} assert.NoError(MarkEnd(exeTask1, "", time.Now(), details, false, &updates)) assert.Equal(evergreen.BuildFailed, updates.BuildNewStatus) assert.True(updates.BuildComplete) assert.Equal(evergreen.VersionFailed, updates.VersionNewStatus) assert.True(updates.VersionComplete) b, err = build.FindOneId(buildID) assert.NoError(err) tasks, err = task.Find(task.ByVersion(b.Version).WithFields(task.BuildIdKey, task.StatusKey, task.ActivatedKey, task.DependsOnKey)) require.NoError(err) complete, _, err = b.AllUnblockedTasksFinished(tasks) assert.NoError(err) assert.True(complete) e, err := event.FindUnprocessedEvents(evergreen.DefaultEventProcessingLimit) assert.NoError(err) assert.Len(e, 7) }
explode_data.jsonl/60441
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 2160 }
[ 2830, 3393, 8949, 3727, 46961, 2403, 25449, 1249, 25664, 93919, 11066, 2522, 1155, 353, 8840, 836, 8, 341, 6948, 1669, 2060, 7121, 1155, 340, 17957, 1669, 1373, 7121, 1155, 692, 17957, 35699, 9791, 13524, 52730, 17483, 28629, 11, 1936, 28...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
1