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 TestHashIncrby(t *testing.T) { s, err := Run() ok(t, err) defer s.Close() c, err := proto.Dial(s.Addr()) ok(t, err) defer c.Close() // New key must1(t, c, "HINCRBY", "hash", "field", "1") // Existing key mustDo(t, c, "HINCRBY", "hash", "field", "100", proto.Int(101), ) // Minus works. mustDo(t, c, "HINCRBY", "hash", "field", "-12", proto.Int(101-12), ) t.Run("direct", func(t *testing.T) { s.HIncr("hash", "field", -3) equals(t, "86", s.HGet("hash", "field")) }) t.Run("errors", func(t *testing.T) { // Wrong key type s.Set("str", "cake") mustDo(t, c, "HINCRBY", "str", "case", "4", proto.Error(msgWrongType), ) mustDo(t, c, "HINCRBY", "str", "case", "foo", proto.Error("ERR value is not an integer or out of range"), ) mustDo(t, c, "HINCRBY", "str", proto.Error(errWrongNumber("hincrby")), ) }) }
explode_data.jsonl/11377
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 440 }
[ 2830, 3393, 6370, 641, 5082, 1694, 1155, 353, 8840, 836, 8, 341, 1903, 11, 1848, 1669, 6452, 741, 59268, 1155, 11, 1848, 340, 16867, 274, 10421, 741, 1444, 11, 1848, 1669, 18433, 98462, 1141, 93626, 2398, 59268, 1155, 11, 1848, 340, 1...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
1
func TestFSThrash(t *testing.T) { files := make(map[string][]byte) if testing.Short() { t.SkipNow() } _, mnt := setupIpnsTest(t, nil) defer mnt.Close() base := mnt.Dir + "/local" dirs := []string{base} dirlock := sync.RWMutex{} filelock := sync.Mutex{} ndirWorkers := 2 nfileWorkers := 2 ndirs := 100 nfiles := 200 wg := sync.WaitGroup{} // Spawn off workers to make directories for i := 0; i < ndirWorkers; i++ { wg.Add(1) go func(worker int) { defer wg.Done() for j := 0; j < ndirs; j++ { dirlock.RLock() n := mrand.Intn(len(dirs)) dir := dirs[n] dirlock.RUnlock() newDir := fmt.Sprintf("%s/dir%d-%d", dir, worker, j) err := os.Mkdir(newDir, os.ModeDir) if err != nil { t.Error(err) continue } dirlock.Lock() dirs = append(dirs, newDir) dirlock.Unlock() } }(i) } // Spawn off workers to make files for i := 0; i < nfileWorkers; i++ { wg.Add(1) go func(worker int) { defer wg.Done() for j := 0; j < nfiles; j++ { dirlock.RLock() n := mrand.Intn(len(dirs)) dir := dirs[n] dirlock.RUnlock() newFileName := fmt.Sprintf("%s/file%d-%d", dir, worker, j) data, err := writeFile(2000+mrand.Intn(5000), newFileName) if err != nil { t.Error(err) continue } filelock.Lock() files[newFileName] = data filelock.Unlock() } }(i) } wg.Wait() for name, data := range files { out, err := ioutil.ReadFile(name) if err != nil { t.Error(err) } if !bytes.Equal(data, out) { t.Errorf("Data didn't match in %s: expected %v, got %v", name, data, out) } } }
explode_data.jsonl/77472
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 806 }
[ 2830, 3393, 37, 784, 4079, 988, 1155, 353, 8840, 836, 8, 341, 74075, 1669, 1281, 9147, 14032, 45725, 3782, 692, 743, 7497, 55958, 368, 341, 197, 3244, 57776, 7039, 741, 197, 532, 197, 6878, 296, 406, 1669, 6505, 23378, 4412, 2271, 115...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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 TestAcceptReject(t *testing.T) { rs := NewRuleSet([]Rule{AcceptRule, RejectRule}) result, rule := rs.Apply(&cb.Envelope{}) if result != Accept { t.Fatalf("Should have accepted") } if rule != AcceptRule { t.Fatalf("Accepted but not for the right rule") } }
explode_data.jsonl/11103
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 100 }
[ 2830, 3393, 16646, 78413, 1155, 353, 8840, 836, 8, 341, 41231, 1669, 1532, 11337, 1649, 10556, 11337, 90, 16646, 11337, 11, 87293, 11337, 3518, 9559, 11, 5912, 1669, 10036, 36051, 2099, 7221, 22834, 18853, 37790, 743, 1102, 961, 20829, 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...
3
func TestGocloak_UserAttributeContains(t *testing.T) { t.Parallel() attributes := map[string][]string{} attributes["foo"] = []string{"bar", "alice", "bob", "roflcopter"} attributes["bar"] = []string{"baz"} client := NewClientWithDebug(t) ok := client.UserAttributeContains(attributes, "foo", "alice") FailIf(t, !ok, "UserAttributeContains") }
explode_data.jsonl/79515
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 130 }
[ 2830, 3393, 38, 509, 385, 585, 31339, 3907, 23805, 1155, 353, 8840, 836, 8, 341, 3244, 41288, 7957, 2822, 197, 12340, 1669, 2415, 14032, 45725, 917, 16094, 197, 12340, 1183, 7975, 1341, 284, 3056, 917, 4913, 2257, 497, 330, 63195, 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 TestSkipContentSha256Cksum(t *testing.T) { testCases := []struct { inputHeaderKey string inputHeaderValue string inputQueryKey string inputQueryValue string expectedResult bool }{ // Test case - 1. // Test case with "X-Amz-Content-Sha256" header set to empty value. {"X-Amz-Content-Sha256", "", "", "", false}, // Test case - 2. // Test case with "X-Amz-Content-Sha256" header set to "UNSIGNED-PAYLOAD" // When "X-Amz-Content-Sha256" header is set to "UNSIGNED-PAYLOAD", validation of content sha256 has to be skipped. {"X-Amz-Content-Sha256", "UNSIGNED-PAYLOAD", "", "", true}, // Test case - 3. // Enabling PreSigned Signature v4. {"", "", "X-Amz-Credential", "", true}, // Test case - 4. // "X-Amz-Content-Sha256" not set and PreSigned Signature v4 not enabled, sha256 checksum calculation is not skipped. {"", "", "X-Amz-Credential", "", true}, } for i, testCase := range testCases { // creating an input HTTP request. // Only the headers are relevant for this particular test. inputReq, err := http.NewRequest("GET", "http://example.com", nil) if err != nil { t.Fatalf("Error initializing input HTTP request: %v", err) } if testCase.inputHeaderKey != "" { inputReq.Header.Set(testCase.inputHeaderKey, testCase.inputHeaderValue) } if testCase.inputQueryKey != "" { q := inputReq.URL.Query() q.Add(testCase.inputQueryKey, testCase.inputQueryValue) inputReq.URL.RawQuery = q.Encode() } actualResult := skipContentSha256Cksum(inputReq) if testCase.expectedResult != actualResult { t.Errorf("Test %d: Expected the result to `%v`, but instead got `%v`", i+1, testCase.expectedResult, actualResult) } } }
explode_data.jsonl/81625
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 646 }
[ 2830, 3393, 35134, 2762, 62316, 17, 20, 21, 34, 74, 1242, 1155, 353, 8840, 836, 8, 341, 18185, 37302, 1669, 3056, 1235, 341, 197, 22427, 4047, 1592, 256, 914, 198, 197, 22427, 97721, 914, 271, 197, 22427, 2859, 1592, 256, 914, 198, ...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
6
func TestFailServe(t *testing.T) { lis := bufconn.Listen(0) lis.Close() core, logs := observer.New(zap.NewAtomicLevelAt(zapcore.ErrorLevel)) var wg sync.WaitGroup wg.Add(1) startServer(grpc.NewServer(), lis, zap.New(core), func(e error) { assert.Equal(t, 1, len(logs.All())) assert.Equal(t, "Could not launch gRPC service", logs.All()[0].Message) wg.Done() }) wg.Wait() }
explode_data.jsonl/15623
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 169 }
[ 2830, 3393, 19524, 60421, 1155, 353, 8840, 836, 8, 341, 8810, 285, 1669, 6607, 5148, 68334, 7, 15, 340, 8810, 285, 10421, 741, 71882, 11, 18422, 1669, 22067, 7121, 13174, 391, 7121, 65857, 4449, 1655, 13174, 391, 2153, 6141, 4449, 1171,...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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 TestLimitRangeUpdate(t *testing.T) { ns := api.NamespaceDefault limitRange := &api.LimitRange{ ObjectMeta: api.ObjectMeta{ Name: "abc", ResourceVersion: "1", }, Spec: api.LimitRangeSpec{ Limits: []api.LimitRangeItem{ { Type: api.LimitTypePod, Max: api.ResourceList{ api.ResourceCPU: resource.MustParse("100"), api.ResourceMemory: resource.MustParse("10000"), }, Min: api.ResourceList{ api.ResourceCPU: resource.MustParse("0"), api.ResourceMemory: resource.MustParse("100"), }, }, }, }, } c := &testClient{ Request: testRequest{Method: "PUT", Path: testapi.ResourcePath(getLimitRangesResourceName(), ns, "abc"), Query: buildQueryValues(nil)}, Response: Response{StatusCode: 200, Body: limitRange}, } response, err := c.Setup().LimitRanges(ns).Update(limitRange) c.Validate(t, response, err) }
explode_data.jsonl/69630
{ "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, 16527, 6046, 4289, 1155, 353, 8840, 836, 8, 341, 84041, 1669, 6330, 46011, 3675, 198, 8810, 2353, 6046, 1669, 609, 2068, 1214, 2353, 6046, 515, 197, 23816, 12175, 25, 6330, 80222, 515, 298, 21297, 25, 310, 330, 13683, 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 TestConfigParsing(t *testing.T) { for _, profile := range []string{ genesisconfig.SampleInsecureSoloProfile, genesisconfig.SampleSingleMSPSoloProfile, genesisconfig.SampleSingleMSPSoloV11Profile, genesisconfig.SampleDevModeSoloProfile, genesisconfig.SampleInsecureKafkaProfile, genesisconfig.SampleSingleMSPKafkaProfile, genesisconfig.SampleSingleMSPKafkaV11Profile, genesisconfig.SampleDevModeKafkaProfile, } { t.Run(profile, func(t *testing.T) { config := genesisconfig.Load(profile) group, err := NewChannelGroup(config) assert.NoError(t, err) assert.NotNil(t, group) _, err = channelconfig.NewBundle("test", &cb.Config{ ChannelGroup: group, }) assert.NoError(t, err) hasModPolicySet(t, "Channel", group) }) } }
explode_data.jsonl/78124
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 298 }
[ 2830, 3393, 2648, 68839, 1155, 353, 8840, 836, 8, 341, 2023, 8358, 5526, 1669, 2088, 3056, 917, 515, 197, 82281, 13774, 1676, 76266, 641, 25132, 89299, 8526, 345, 197, 82281, 13774, 1676, 76266, 10888, 44, 4592, 89299, 8526, 345, 197, 8...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
1
func TestNewAPIToken(t *testing.T) { readonlyRoot, err := NewAPIToken("0", "/", true) if err != nil { t.Fatal("Got error generating token: ", err) } if readonlyRoot.Write != true { t.Fatal("Expected write token in return") } if readonlyRoot.Resource != "/" { t.Fatal("Expected root token") } if readonlyRoot.UserID != "0" { t.Fatal("Expected user ID to be 0") } const tokenCount = 1000 t.Logf("Generating %d tokens...", tokenCount) // Make 100 tokens and ensure they're all different tokens := make(map[string]APIToken) for i := 0; i < tokenCount; i++ { newToken, err := NewAPIToken("0", "/foo", false) if err != nil { t.Fatal("Got error generating token: ", err) } t.Logf("T=%s", newToken.Token) tokens[newToken.Token] = newToken } if len(tokens) != tokenCount { t.Fatalf("Did not get the expected number of tokens. Got %d, expected %d", len(tokens), tokenCount) } }
explode_data.jsonl/45709
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 353 }
[ 2830, 3393, 3564, 2537, 952, 1679, 1155, 353, 8840, 836, 8, 341, 197, 22569, 8439, 11, 1848, 1669, 1532, 2537, 952, 1679, 445, 15, 497, 64657, 830, 340, 743, 1848, 961, 2092, 341, 197, 3244, 26133, 445, 32462, 1465, 23163, 3950, 25, ...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
8
func TestOffset(t *testing.T) { var posts []*Post qs := dORM.QueryTable("post") num, err := qs.Limit(1).Offset(2).All(&posts) throwFail(t, err) throwFail(t, AssertIs(num, 1)) num, err = qs.Offset(2).All(&posts) throwFail(t, err) throwFail(t, AssertIs(num, 2)) }
explode_data.jsonl/18132
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 119 }
[ 2830, 3393, 6446, 1155, 353, 8840, 836, 8, 341, 2405, 7999, 29838, 4133, 198, 18534, 82, 1669, 294, 4365, 15685, 2556, 445, 2203, 1138, 22431, 11, 1848, 1669, 32421, 1214, 2353, 7, 16, 568, 6446, 7, 17, 568, 2403, 2099, 12664, 340, ...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
1
func TestTmpfsDevShmNoDupMount(t *testing.T) { c := &container.Container{ ShmPath: "foobar", // non-empty, for c.IpcMounts() to work HostConfig: &containertypes.HostConfig{ IpcMode: containertypes.IpcMode("shareable"), // default mode // --tmpfs /dev/shm:rw,exec,size=NNN Tmpfs: map[string]string{ "/dev/shm": "rw,exec,size=1g", }, }, } d := setupFakeDaemon(t, c) defer cleanupFakeContainer(c) _, err := d.createSpec(c) assert.Check(t, err) }
explode_data.jsonl/51542
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 207 }
[ 2830, 3393, 35986, 3848, 14592, 2016, 76, 2753, 85713, 16284, 1155, 353, 8840, 836, 8, 341, 1444, 1669, 609, 3586, 33672, 515, 197, 197, 2016, 76, 1820, 25, 330, 50267, 497, 442, 2477, 39433, 11, 369, 272, 2447, 3992, 16284, 82, 368, ...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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_PutGetDeleteWithPrefix(t *testing.T) { endpoint := os.Getenv("ETCD_ENDPOINT") if endpoint == "" { t.Error("not found env ETCD_ENDPOINT or ETCD_ENDPOINT is empty string") return } fmt.Printf("endpoint=[%s]\n", endpoint) Init(endpoint) defer Close() for i := range make([]int, 3) { err := Put(fmt.Sprintf("key_%d", i), fmt.Sprintf("value_%d", i)) if err != nil { log.Fatal(err) } } kvs, err := GetWithPrefix("key_") if err != nil { t.Error(err) return } fmt.Println(kvs) n, err := DeleteWithPrefix("key_") if err != nil { t.Error(err) return } fmt.Println(n) }
explode_data.jsonl/27603
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 282 }
[ 2830, 3393, 1088, 332, 1949, 6435, 2354, 14335, 1155, 353, 8840, 836, 8, 341, 6246, 2768, 1669, 2643, 64883, 445, 1348, 6484, 48756, 1138, 743, 14887, 621, 1591, 341, 197, 3244, 6141, 445, 1921, 1730, 6105, 17768, 6484, 48756, 476, 1776...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
6
func TestCreateZipfGenerator(t *testing.T) { defer leaktest.AfterTest(t)() for _, gen := range gens { rng := rand.New(rand.NewSource(timeutil.Now().UnixNano())) _, err := NewZipfGenerator(rng, gen.iMin, gen.iMax, gen.theta, false) if err != nil { t.Fatal(err) } } }
explode_data.jsonl/54583
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 125 }
[ 2830, 3393, 4021, 31047, 69, 12561, 1155, 353, 8840, 836, 8, 341, 16867, 23352, 1944, 36892, 2271, 1155, 8, 741, 2023, 8358, 4081, 1669, 2088, 46004, 341, 197, 7000, 968, 1669, 10382, 7121, 37595, 7121, 3608, 9730, 1314, 13244, 1005, 55...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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 TestStructLevelInvalidError(t *testing.T) { validate := New() validate.RegisterStructValidation(StructLevelInvalidError, StructLevelInvalidErr{}) var test StructLevelInvalidErr err := validate.Struct(test) NotEqual(t, err, nil) errs, ok := err.(ValidationErrors) Equal(t, ok, true) fe := errs[0] Equal(t, fe.Field(), "Value") Equal(t, fe.StructField(), "Value") Equal(t, fe.Namespace(), "StructLevelInvalidErr.Value") Equal(t, fe.StructNamespace(), "StructLevelInvalidErr.Value") Equal(t, fe.Tag(), "required") Equal(t, fe.ActualTag(), "required") Equal(t, fe.Kind(), reflect.Invalid) Equal(t, fe.Type(), reflect.TypeOf(nil)) }
explode_data.jsonl/77215
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 245 }
[ 2830, 3393, 9422, 4449, 7928, 1454, 1155, 353, 8840, 836, 8, 1476, 197, 7067, 1669, 1532, 741, 197, 7067, 19983, 9422, 13799, 7, 9422, 4449, 7928, 1454, 11, 16139, 4449, 7928, 7747, 6257, 692, 2405, 1273, 16139, 4449, 7928, 7747, 271, ...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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 TestEscapeMarkdownOne(t *testing.T) { provider := [][]string{ {"user", "user"}, {"user_name", `user\_name`}, {"user_name_long", `user\_name\_long`}, {`user\_name\_escaped`, `user\_name\_escaped`}, } for _, testCase := range provider { assert.Equal(t, testCase[1], escapeMarkdownOne(testCase[0])) } }
explode_data.jsonl/17934
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 139 }
[ 2830, 3393, 48124, 68005, 3966, 1155, 353, 8840, 836, 8, 341, 197, 19979, 1669, 52931, 917, 515, 197, 197, 4913, 872, 497, 330, 872, 7115, 197, 197, 4913, 872, 1269, 497, 1565, 872, 75738, 606, 63, 1583, 197, 197, 4913, 872, 1269, 1...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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 TestProwJobToPod_setsTerminationGracePeriodSeconds(t *testing.T) { testCases := []struct { name string prowjob *prowapi.ProwJob expectedTerminationGracePeriodSeconds int64 }{ { name: "GracePeriodSeconds from decoration config", prowjob: &prowapi.ProwJob{ Spec: prowapi.ProwJobSpec{ PodSpec: &coreapi.PodSpec{Containers: []coreapi.Container{{}}}, DecorationConfig: &prowapi.DecorationConfig{ UtilityImages: &prowapi.UtilityImages{}, GracePeriod: &prowapi.Duration{Duration: 10 * time.Second}, }, }, }, expectedTerminationGracePeriodSeconds: 12, }, { name: "Existing GracePeriodSeconds is not overwritten", prowjob: &prowapi.ProwJob{ Spec: prowapi.ProwJobSpec{ PodSpec: &coreapi.PodSpec{TerminationGracePeriodSeconds: utilpointer.Int64Ptr(60), Containers: []coreapi.Container{{}}}, DecorationConfig: &prowapi.DecorationConfig{ UtilityImages: &prowapi.UtilityImages{}, Timeout: &prowapi.Duration{Duration: 10 * time.Second}, }, }, }, expectedTerminationGracePeriodSeconds: 60, }, } for idx := range testCases { tc := testCases[idx] t.Run(tc.name, func(t *testing.T) { t.Parallel() if err := decorate(tc.prowjob.Spec.PodSpec, tc.prowjob, map[string]string{}, ""); err != nil { t.Fatalf("decoration failed: %v", err) } if tc.prowjob.Spec.PodSpec.TerminationGracePeriodSeconds == nil || *tc.prowjob.Spec.PodSpec.TerminationGracePeriodSeconds != tc.expectedTerminationGracePeriodSeconds { t.Errorf("expected pods TerminationGracePeriodSeconds to be %d was %v", tc.expectedTerminationGracePeriodSeconds, tc.prowjob.Spec.PodSpec.TerminationGracePeriodSeconds) } }) } }
explode_data.jsonl/79315
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 781 }
[ 2830, 3393, 47, 651, 12245, 1249, 23527, 21289, 21209, 32096, 86543, 23750, 15343, 1155, 353, 8840, 836, 8, 341, 18185, 37302, 1669, 3056, 1235, 341, 197, 11609, 6656, 914, 198, 197, 3223, 651, 8799, 7561, 353, 79, 651, 2068, 1069, 651,...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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 TestPRG(t *testing.T) { mod := big.NewInt(3123130983042421) ns := 13 leader := 3 gen := NewGenPRG(ns, leader) v := big.NewInt(123131) shares := gen.Share(mod, v) res := new(big.Int) for i := 0; i < ns; i++ { res.Add(res, shares[i]) } res.Mod(res, mod) if res.Cmp(v) != 0 { t.Fail() } for i := 0; i < ns; i++ { hints := gen.Hints(i) replay := NewReplayPRG(i, leader) replay.Import(hints) r := replay.Get(mod) if shares[i].Cmp(r) != 0 { t.Fail() } } }
explode_data.jsonl/8679
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 248 }
[ 2830, 3393, 6480, 38, 1155, 353, 8840, 836, 8, 341, 42228, 1669, 2409, 7121, 1072, 7, 18, 16, 17, 18, 16, 18, 15, 24, 23, 18, 15, 19, 17, 19, 17, 16, 692, 84041, 1669, 220, 16, 18, 198, 197, 37391, 1669, 220, 18, 198, 82281, ...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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 TestGetPersistentVolumeDetail(t *testing.T) { cases := []struct { name string persistentVolume *api.PersistentVolume expected *PersistentVolumeDetail }{ { "foo", &api.PersistentVolume{ ObjectMeta: metaV1.ObjectMeta{Name: "foo"}, Spec: api.PersistentVolumeSpec{ PersistentVolumeReclaimPolicy: api.PersistentVolumeReclaimRecycle, AccessModes: []api.PersistentVolumeAccessMode{api.ReadWriteOnce}, Capacity: nil, ClaimRef: &api.ObjectReference{ Name: "myclaim-name", Namespace: "default", }, PersistentVolumeSource: api.PersistentVolumeSource{ HostPath: &api.HostPathVolumeSource{ Path: "my-path", }, }, }, Status: api.PersistentVolumeStatus{ Phase: api.VolumePending, Message: "my-message", }, }, &PersistentVolumeDetail{ TypeMeta: common.TypeMeta{Kind: "persistentvolume"}, ObjectMeta: common.ObjectMeta{Name: "foo"}, Status: api.VolumePending, ReclaimPolicy: api.PersistentVolumeReclaimRecycle, AccessModes: []api.PersistentVolumeAccessMode{api.ReadWriteOnce}, Capacity: nil, Claim: "default/myclaim-name", Message: "my-message", PersistentVolumeSource: api.PersistentVolumeSource{ HostPath: &api.HostPathVolumeSource{ Path: "my-path", }, }, }, }, } for _, c := range cases { fakeClient := fake.NewSimpleClientset(c.persistentVolume) actual, err := GetPersistentVolumeDetail(fakeClient, c.name) if err != nil { t.Errorf("GetPersistentVolumeDetail(%#v) == \ngot err %#v", c.persistentVolume, err) } if !reflect.DeepEqual(actual, c.expected) { t.Errorf("GetPersistentVolumeDetail(%#v) == \n%#v\nexpected \n%#v\n", c.persistentVolume, actual, c.expected) } } }
explode_data.jsonl/54241
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 839 }
[ 2830, 3393, 1949, 53194, 18902, 10649, 1155, 353, 8840, 836, 8, 341, 1444, 2264, 1669, 3056, 1235, 341, 197, 11609, 1797, 914, 198, 197, 3223, 13931, 18902, 353, 2068, 61655, 18902, 198, 197, 42400, 260, 353, 53194, 18902, 10649, 198, 1...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
4
func TestRouterTimeout(t *testing.T) { // Create a timeout manager maxTimeout := 25 * time.Millisecond tm := timeout.Manager{} err := tm.Initialize(&timer.AdaptiveTimeoutConfig{ InitialTimeout: 10 * time.Millisecond, MinimumTimeout: 10 * time.Millisecond, MaximumTimeout: maxTimeout, TimeoutCoefficient: 1, TimeoutHalflife: 5 * time.Minute, MetricsNamespace: "", Registerer: prometheus.NewRegistry(), }, benchlist.NewNoBenchlist()) if err != nil { t.Fatal(err) } go tm.Dispatch() // Create a router chainRouter := ChainRouter{} err = chainRouter.Initialize(ids.ShortEmpty, logging.NoLog{}, &tm, time.Hour, time.Millisecond, ids.Set{}, nil, HealthConfig{}, "", prometheus.NewRegistry()) assert.NoError(t, err) // Create an engine and handler engine := common.EngineTest{T: t} engine.Default(false) var ( calledGetFailed, calledGetAncestorsFailed, calledQueryFailed, calledQueryFailed2, calledGetAcceptedFailed, calledGetAcceptedFrontierFailed bool wg = sync.WaitGroup{} ) engine.GetFailedF = func(validatorID ids.ShortID, requestID uint32) error { wg.Done(); calledGetFailed = true; return nil } engine.GetAncestorsFailedF = func(validatorID ids.ShortID, requestID uint32) error { defer wg.Done() calledGetAncestorsFailed = true return nil } engine.QueryFailedF = func(validatorID ids.ShortID, requestID uint32) error { defer wg.Done() if !calledQueryFailed { calledQueryFailed = true return nil } calledQueryFailed2 = true return nil } engine.GetAcceptedFailedF = func(validatorID ids.ShortID, requestID uint32) error { defer wg.Done() calledGetAcceptedFailed = true return nil } engine.GetAcceptedFrontierFailedF = func(validatorID ids.ShortID, requestID uint32) error { defer wg.Done() calledGetAcceptedFrontierFailed = true return nil } engine.ContextF = snow.DefaultContextTest handler := &Handler{} err = handler.Initialize( &engine, validators.NewSet(), nil, DefaultMaxNonStakerPendingMsgs, DefaultMaxNonStakerPendingMsgs, DefaultStakerPortion, DefaultStakerPortion, "", prometheus.NewRegistry(), ) assert.NoError(t, err) chainRouter.AddChain(handler) go handler.Dispatch() // Register requests for each request type msgs := []constants.MsgType{ constants.GetMsg, constants.GetAncestorsMsg, constants.PullQueryMsg, constants.PushQueryMsg, constants.GetAcceptedMsg, constants.GetAcceptedFrontierMsg, } wg.Add(len(msgs)) for i, msg := range msgs { chainRouter.RegisterRequest(ids.GenerateTestShortID(), handler.ctx.ChainID, uint32(i), msg) } wg.Wait() chainRouter.lock.Lock() defer chainRouter.lock.Unlock() assert.True(t, calledGetFailed && calledGetAncestorsFailed && calledQueryFailed2 && calledGetAcceptedFailed && calledGetAcceptedFrontierFailed) }
explode_data.jsonl/3079
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 1057 }
[ 2830, 3393, 9523, 7636, 1155, 353, 8840, 836, 8, 341, 197, 322, 4230, 264, 9632, 6645, 198, 22543, 7636, 1669, 220, 17, 20, 353, 882, 71482, 198, 3244, 76, 1669, 9632, 58298, 16094, 9859, 1669, 17333, 45829, 2099, 19278, 17865, 27781, ...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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 TestExpiration(t *testing.T) { nodeNum := 5 bootPeers := []string{bootPeer(2611), bootPeer(2612)} instances := []*gossipInstance{} inst := createDiscoveryInstance(2611, "d1", bootPeers) instances = append(instances, inst) inst = createDiscoveryInstance(2612, "d2", bootPeers) instances = append(instances, inst) for i := 3; i <= nodeNum; i++ { id := fmt.Sprintf("d%d", i) inst = createDiscoveryInstance(2610+i, id, bootPeers) instances = append(instances, inst) } assertMembership(t, instances, nodeNum-1) waitUntilOrFailBlocking(t, instances[nodeNum-1].Stop) waitUntilOrFailBlocking(t, instances[nodeNum-2].Stop) assertMembership(t, instances[:len(instances)-2], nodeNum-3) stopAction := &sync.WaitGroup{} for i, inst := range instances { if i+2 == nodeNum { break } stopAction.Add(1) go func(inst *gossipInstance) { defer stopAction.Done() inst.Stop() }(inst) } waitUntilOrFailBlocking(t, stopAction.Wait) }
explode_data.jsonl/62264
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 375 }
[ 2830, 3393, 66301, 1155, 353, 8840, 836, 8, 341, 20831, 4651, 1669, 220, 20, 198, 197, 4619, 10197, 388, 1669, 3056, 917, 90, 4619, 30888, 7, 17, 21, 16, 16, 701, 10459, 30888, 7, 17, 21, 16, 17, 10569, 197, 47825, 1669, 29838, 70...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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 TestPatternAlbumsToEntries(t *testing.T) { f := newTestLister(t) ctx := context.Background() _, err := albumsToEntries(ctx, f, false, "potato/", "sub") assert.Equal(t, fs.ErrorDirNotFound, err) f.albums.add(&api.Album{ ID: "1", Title: "sub/one", }) entries, err := albumsToEntries(ctx, f, false, "potato/", "sub") assert.NoError(t, err) assert.Equal(t, 1, len(entries)) assert.Equal(t, "potato/one", entries[0].Remote()) _, ok := entries[0].(fs.Directory) assert.Equal(t, true, ok) f.albums.add(&api.Album{ ID: "1", Title: "sub", }) f.names = []string{"file.jpg"} entries, err = albumsToEntries(ctx, f, false, "potato/", "sub") assert.NoError(t, err) assert.Equal(t, 2, len(entries)) assert.Equal(t, "potato/one", entries[0].Remote()) _, ok = entries[0].(fs.Directory) assert.Equal(t, true, ok) assert.Equal(t, "potato/file.jpg", entries[1].Remote()) _, ok = entries[1].(fs.Object) assert.Equal(t, true, ok) }
explode_data.jsonl/24372
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 424 }
[ 2830, 3393, 15760, 32378, 82, 1249, 24533, 1155, 353, 8840, 836, 8, 341, 1166, 1669, 501, 2271, 852, 261, 1155, 340, 20985, 1669, 2266, 19047, 2822, 197, 6878, 1848, 1669, 27685, 1249, 24533, 7502, 11, 282, 11, 895, 11, 330, 19099, 43...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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 TestServicecheckQsIDs(t *testing.T) { convey.Convey("checkQsIDs", t, func() { ok, err := s.checkQsIDs(context.Background(), []int64{}, 0, []int64{}, 0) convey.So(err, convey.ShouldBeNil) convey.So(ok, convey.ShouldNotBeNil) }) }
explode_data.jsonl/21128
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 105 }
[ 2830, 3393, 1860, 2028, 48, 82, 30466, 1155, 353, 8840, 836, 8, 341, 37203, 5617, 4801, 5617, 445, 2028, 48, 82, 30466, 497, 259, 11, 2915, 368, 341, 197, 59268, 11, 1848, 1669, 274, 9093, 48, 82, 30466, 5378, 19047, 1507, 3056, 396...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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 TestPCollection_sizeReset(t *testing.T) { // Check the initial values after resetting. var pcol PCollection pcol.resetSize() snap := pcol.snapshot() checkPCollectionSizeSample(t, snap, 0, 0, math.MaxInt64, math.MinInt64) }
explode_data.jsonl/34966
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 83 }
[ 2830, 3393, 4872, 1908, 2368, 14828, 1155, 353, 8840, 836, 8, 341, 197, 322, 4248, 279, 2856, 2750, 1283, 78028, 624, 2405, 281, 2074, 393, 6482, 198, 3223, 2074, 13857, 1695, 741, 1903, 6861, 1669, 281, 2074, 52677, 741, 25157, 4872, ...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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 TestBackTrace(t *testing.T) { l, b := newBufferedRevelLog() log.Logger = l log.Error("an error") _, file, line, _ := runtime.Caller(0) mustContain := fmt.Sprintf("%s:%d", filepath.Base(file), line-1) actual := b.String() if ok := strings.Contains(actual, mustContain); !ok { t.Errorf("Log output mismatch %s (actual) != %s (expected)", actual, mustContain) } }
explode_data.jsonl/3456
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 148 }
[ 2830, 3393, 3707, 6550, 1155, 353, 8840, 836, 8, 341, 8810, 11, 293, 1669, 501, 4095, 291, 693, 889, 2201, 741, 6725, 12750, 284, 326, 198, 6725, 6141, 445, 276, 1465, 1138, 197, 6878, 1034, 11, 1555, 11, 716, 1669, 15592, 727, 1395...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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 TestGetDockerLBPort(t *testing.T) { clusterName := "clusterName" wantPort := "test:port" clusterLBName := fmt.Sprintf("%s-lb", clusterName) ctx := context.Background() mockCtrl := gomock.NewController(t) executable := mockexecutables.NewMockExecutable(mockCtrl) executable.EXPECT().Execute(ctx, []string{"port", clusterLBName, "6443/tcp"}).Return(*bytes.NewBufferString(wantPort), nil) d := executables.NewDocker(executable) _, err := d.GetDockerLBPort(ctx, clusterName) if err != nil { t.Fatalf("Docker.GetDockerLBPort() error = %v, want nil", err) } }
explode_data.jsonl/6801
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 217 }
[ 2830, 3393, 1949, 35, 13659, 34068, 7084, 1155, 353, 8840, 836, 8, 341, 197, 18855, 675, 1669, 330, 18855, 675, 698, 50780, 7084, 1669, 330, 1944, 25, 403, 698, 197, 18855, 34068, 675, 1669, 8879, 17305, 4430, 82, 2852, 65, 497, 10652...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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_validateMultisigThreshold(t *testing.T) { type args struct { k int nKeys int } tests := []struct { name string args args wantErr bool }{ {"zeros", args{0, 0}, true}, {"1-0", args{1, 0}, true}, {"1-1", args{1, 1}, false}, {"1-2", args{1, 1}, false}, {"1-2", args{2, 1}, true}, } for _, tt := range tests { tt := tt t.Run(tt.name, func(t *testing.T) { if err := validateMultisigThreshold(tt.args.k, tt.args.nKeys); (err != nil) != tt.wantErr { t.Errorf("validateMultisigThreshold() error = %v, wantErr %v", err, tt.wantErr) } }) } }
explode_data.jsonl/13881
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 288 }
[ 2830, 3393, 42681, 40404, 285, 343, 37841, 1155, 353, 8840, 836, 8, 341, 13158, 2827, 2036, 341, 197, 16463, 257, 526, 198, 197, 9038, 8850, 526, 198, 197, 532, 78216, 1669, 3056, 1235, 341, 197, 11609, 262, 914, 198, 197, 31215, 262,...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
2
func TestImagePull(t *testing.T) { client, err := newClient(t, address) if err != nil { t.Fatal(err) } defer client.Close() ctx, cancel := testContext() defer cancel() _, err = client.Pull(ctx, testImage, WithPlatform(platforms.Default())) if err != nil { t.Fatal(err) } }
explode_data.jsonl/37732
{ "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, 1906, 36068, 1155, 353, 8840, 836, 8, 341, 25291, 11, 1848, 1669, 501, 2959, 1155, 11, 2621, 340, 743, 1848, 961, 2092, 341, 197, 3244, 26133, 3964, 340, 197, 532, 16867, 2943, 10421, 2822, 20985, 11, 9121, 1669, 1273, 197...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
3
func TestBadConfigs(t *testing.T) { for _, ee := range expectedErrors { _, err := LoadFile("testdata/" + ee.filename) require.Error(t, err, "%s", ee.filename) require.Contains(t, err.Error(), ee.errMsg, "Expected error for %s to contain %q but got: %s", ee.filename, ee.errMsg, err) } }
explode_data.jsonl/81278
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 123 }
[ 2830, 3393, 17082, 84905, 1155, 353, 8840, 836, 8, 341, 2023, 8358, 36343, 1669, 2088, 3601, 13877, 341, 197, 197, 6878, 1848, 1669, 8893, 1703, 445, 92425, 11225, 488, 36343, 30882, 340, 197, 17957, 6141, 1155, 11, 1848, 11, 5962, 82, ...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
2
func TestDomainSuffix(t *testing.T) { //Test cases cases := map[string]string{ "http://google.com": "com", "http://google.com/ding?true": "com", "google.com/?ding=false": "com", "google.com?ding=false": "com", "nonexist.***": "", "google.com": "com", "google.co.uk": "co.uk", "gama.google.com": "com", "gama.google.co.uk": "co.uk", "beta.gama.google.co.uk": "co.uk", } //Test each domain, some should fail (expected) for url, expectedSuffix := range cases { domainSuffix := DomainSuffix(url) if domainSuffix != expectedSuffix { t.Errorf("Url (%q) returned %q for DomainSuffix(), but %q was expected", url, domainSuffix, expectedSuffix) } } }
explode_data.jsonl/30832
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 381 }
[ 2830, 3393, 13636, 40177, 1155, 353, 8840, 836, 8, 341, 197, 322, 2271, 5048, 198, 1444, 2264, 1669, 2415, 14032, 30953, 515, 197, 197, 76932, 1110, 17485, 905, 788, 1843, 330, 874, 756, 197, 197, 76932, 1110, 17485, 905, 3446, 287, 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 TestRest_UserAllData(t *testing.T) { ts, srv, teardown := startupT(t) defer teardown() // write 3 comments user := store.User{ID: "dev", Name: "user name 1"} c1 := store.Comment{User: user, Text: "test test #1", Locator: store.Locator{SiteID: "remark42", URL: "https://radio-t.com/blah1"}, Timestamp: time.Date(2018, 5, 27, 1, 14, 10, 0, time.Local)} c2 := store.Comment{User: user, Text: "test test #2", ParentID: "p1", Locator: store.Locator{SiteID: "remark42", URL: "https://radio-t.com/blah1"}, Timestamp: time.Date(2018, 5, 27, 1, 14, 20, 0, time.Local)} c3 := store.Comment{User: user, Text: "test test #3", ParentID: "p1", Locator: store.Locator{SiteID: "remark42", URL: "https://radio-t.com/blah1"}, Timestamp: time.Date(2018, 5, 27, 1, 14, 25, 0, time.Local)} _, err := srv.DataService.Create(c1) require.NoError(t, err, "%+v", err) _, err = srv.DataService.Create(c2) require.NoError(t, err) _, err = srv.DataService.Create(c3) require.NoError(t, err) client := &http.Client{Timeout: 1 * time.Second} req, err := http.NewRequest("GET", ts.URL+"/api/v1/userdata?site=remark42", nil) require.NoError(t, err) req.Header.Add("X-JWT", devToken) resp, err := client.Do(req) require.NoError(t, err) require.Equal(t, 200, resp.StatusCode) require.Equal(t, "application/gzip", resp.Header.Get("Content-Type")) ungzReader, err := gzip.NewReader(resp.Body) assert.NoError(t, err) require.NoError(t, resp.Body.Close()) ungzBody, err := ioutil.ReadAll(ungzReader) assert.NoError(t, err) strUungzBody := string(ungzBody) assert.True(t, strings.HasPrefix(strUungzBody, `{"info": {"name":"developer one","id":"dev","picture":"http://example.com/pic.png","ip":"127.0.0.1","admin":false,"site_id":"remark42"}, "comments":[{`)) assert.Equal(t, 3, strings.Count(strUungzBody, `"text":`), "3 comments inside") parsed := struct { Info store.User `json:"info"` Comments []store.Comment `json:"comments"` }{} err = json.Unmarshal(ungzBody, &parsed) assert.NoError(t, err) assert.Equal(t, store.User{Name: "developer one", ID: "dev", Picture: "http://example.com/pic.png", IP: "127.0.0.1", SiteID: "remark42"}, parsed.Info) assert.Equal(t, 3, len(parsed.Comments)) req, err = http.NewRequest("GET", ts.URL+"/api/v1/userdata?site=remark42", nil) require.NoError(t, err) resp, err = client.Do(req) require.NoError(t, err) require.NoError(t, resp.Body.Close()) require.Equal(t, 401, resp.StatusCode) }
explode_data.jsonl/37402
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 1014 }
[ 2830, 3393, 12416, 31339, 2403, 1043, 1155, 353, 8840, 836, 8, 341, 57441, 11, 43578, 11, 49304, 1669, 20567, 51, 1155, 340, 16867, 49304, 2822, 197, 322, 3270, 220, 18, 6042, 198, 19060, 1669, 3553, 7344, 90, 915, 25, 330, 3583, 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 TestFormatterReset(test *testing.T) { f := formatter.New() assert.Equal(test, "z", f.SetPlaceholder("z").GetPlaceholder()) assert.Equal(test, "[", f.SetDelimiters("[", "]").GetLeftDelimiter()) assert.NotEmpty(test, f.AddFunction("f", func() {}).GetFunctions()) assert.Equal(test, f, f.Reset()) assert.Equal(test, formatter.DefaultPlaceholder, f.GetPlaceholder()) assert.Equal(test, formatter.DefaultLeftDelimiter, f.GetLeftDelimiter()) assert.Equal(test, formatter.DefaultRightDelimiter, f.GetRightDelimiter()) assert.Empty(test, f.GetFunctions()) }
explode_data.jsonl/39735
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 207 }
[ 2830, 3393, 14183, 14828, 8623, 353, 8840, 836, 8, 341, 1166, 1669, 24814, 7121, 2822, 6948, 12808, 8623, 11, 330, 89, 497, 282, 4202, 48305, 445, 89, 1827, 1949, 48305, 2398, 6948, 12808, 8623, 11, 10545, 497, 282, 4202, 16532, 67645, ...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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 TestAccAlicloudOssBucketObject_source(t *testing.T) { tmpFile, err := ioutil.TempFile("", "tf-oss-object-test-acc-source") if err != nil { t.Fatal(err) } defer os.Remove(tmpFile.Name()) // first write some data to the tempfile just so it's not 0 bytes. err = ioutil.WriteFile(tmpFile.Name(), []byte("{anything will do }"), 0644) if err != nil { t.Fatal(err) } var obj http.Header bucket := fmt.Sprintf("tf-testacc-object-source-%d", acctest.RandInt()) resource.Test(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t) }, Providers: testAccProviders, CheckDestroy: testAccCheckAlicloudOssBucketObjectDestroy, Steps: []resource.TestStep{ resource.TestStep{ Config: fmt.Sprintf(` resource "alicloud_oss_bucket" "bucket" { bucket = "%s" } resource "alicloud_oss_bucket_object" "source" { bucket = "${alicloud_oss_bucket.bucket.bucket}" key = "test-object-source-key" source = "%s" content_type = "binary/octet-stream" }`, bucket, tmpFile.Name()), Check: testAccCheckAlicloudOssBucketObjectExists( "alicloud_oss_bucket_object.source", bucket, obj), }, }, }) }
explode_data.jsonl/1526
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 519 }
[ 2830, 3393, 14603, 32, 415, 52178, 46, 778, 36018, 1190, 10347, 1155, 353, 8840, 836, 8, 341, 20082, 1703, 11, 1848, 1669, 43144, 65009, 1703, 19814, 330, 8935, 12, 3662, 40432, 16839, 12, 4475, 30774, 1138, 743, 1848, 961, 2092, 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...
1
func Test_Bubble(t *testing.T) { array := []int{10,50,60,1,29,95,02,6,025,4521,020,4515,2,5,15,24,65,6,1,051,10,24,45,1,4,51,42} list := Bubble(array) t.Logf("%+v",list) }
explode_data.jsonl/14877
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 102 }
[ 2830, 3393, 1668, 14600, 1155, 353, 8840, 836, 8, 220, 341, 11923, 1669, 3056, 396, 90, 16, 15, 11, 20, 15, 11, 21, 15, 11, 16, 11, 17, 24, 11, 24, 20, 11, 15, 17, 11, 21, 11, 15, 17, 20, 11, 19, 20, 17, 16, 11, 15, 17, ...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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 TestFailureBadLogs(t *testing.T) { badLogsESSpan, err := loadESSpanFixture(1) require.NoError(t, err) badLogsESSpan.Logs = []Log{ { Timestamp: 0, Fields: []KeyValue{ { Key: "sneh", Value: "", Type: "badType", }, }, }, } failingSpanTransform(t, &badLogsESSpan, "not a valid ValueType string badType") }
explode_data.jsonl/5146
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 176 }
[ 2830, 3393, 17507, 17082, 51053, 1155, 353, 8840, 836, 8, 341, 2233, 329, 51053, 9996, 848, 11, 1848, 1669, 2795, 9996, 848, 18930, 7, 16, 340, 17957, 35699, 1155, 11, 1848, 340, 2233, 329, 51053, 9996, 848, 5247, 82, 284, 3056, 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 TestParseGrowth_ExponentialGrowth(t *testing.T) { // Valid linear growth g, err := tester.ParseGrowth("^10") require.NoError(t, err) assert.IsType(t, new(tester.ExponentialGrowth), g) assert.Equal(t, 10, g.(*tester.ExponentialGrowth).Precision) // Invalid value _, err = tester.ParseGrowth("^abcdef") assert.EqualError(t, err, "strconv.Atoi: parsing \"abcdef\": invalid syntax") _, err = tester.ParseGrowth("^99.9") assert.EqualError(t, err, "strconv.Atoi: parsing \"99.9\": invalid syntax") }
explode_data.jsonl/66521
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 200 }
[ 2830, 3393, 14463, 38, 19089, 62531, 59825, 38, 19089, 1155, 353, 8840, 836, 8, 341, 197, 322, 7818, 13482, 6513, 198, 3174, 11, 1848, 1669, 37111, 8937, 38, 19089, 48654, 16, 15, 1138, 17957, 35699, 1155, 11, 1848, 692, 6948, 4506, 9...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
1
func TestColorMApply(t *testing.T) { mono := ebiten.ColorM{} mono.ChangeHSV(0, 0, 1) shiny := ebiten.ColorM{} shiny.Translate(1, 1, 1, 0) shift := ebiten.ColorM{} shift.Translate(0.5, 0.5, 0.5, 0.5) cases := []struct { ColorM ebiten.ColorM In color.Color Out color.Color Delta uint32 }{ { ColorM: ebiten.ColorM{}, In: color.RGBA{1, 2, 3, 4}, Out: color.RGBA{1, 2, 3, 4}, Delta: 0x101, }, { ColorM: mono, In: color.NRGBA{0xff, 0xff, 0xff, 0}, Out: color.Transparent, Delta: 0x101, }, { ColorM: mono, In: color.RGBA{0xff, 0, 0, 0xff}, Out: color.RGBA{0x4c, 0x4c, 0x4c, 0xff}, Delta: 0x101, }, { ColorM: shiny, In: color.RGBA{0x80, 0x90, 0xa0, 0xb0}, Out: color.RGBA{0xb0, 0xb0, 0xb0, 0xb0}, Delta: 1, }, { ColorM: shift, In: color.RGBA{0x00, 0x00, 0x00, 0x00}, Out: color.RGBA{0x40, 0x40, 0x40, 0x80}, Delta: 0x101, }, } for _, c := range cases { out := c.ColorM.Apply(c.In) r0, g0, b0, a0 := out.RGBA() r1, g1, b1, a1 := c.Out.RGBA() if absDiffU32(r0, r1) > c.Delta || absDiffU32(g0, g1) > c.Delta || absDiffU32(b0, b1) > c.Delta || absDiffU32(a0, a1) > c.Delta { t.Errorf("%v.Apply(%v) = {%d, %d, %d, %d}, want {%d, %d, %d, %d}", c.ColorM, c.In, r0, g0, b0, a0, r1, g1, b1, a1) } } }
explode_data.jsonl/48454
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 794 }
[ 2830, 3393, 1636, 44, 28497, 1155, 353, 8840, 836, 8, 341, 197, 56401, 1669, 384, 4489, 268, 6669, 44, 16094, 197, 56401, 39348, 98930, 7, 15, 11, 220, 15, 11, 220, 16, 692, 36196, 6441, 1669, 384, 4489, 268, 6669, 44, 16094, 36196,...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
6
func TestMemory_SignCsrErrorParsingTTL(t *testing.T) { m := populateCert(t) config := configuration{ TrustDomain: "localhost", KeySize: 2048, TTL: "abc", CertSubject: certSubjectConfig{ Country: []string{"US"}, Organization: []string{"SPIFFE"}, CommonName: "", }} pluginConfig, err := populateConfigPlugin(config) _, err = m.Configure(pluginConfig) require.NoError(t, err) wcsr := createWorkloadCSR(t, "spiffe://localhost") wcert, err := m.SignCsr(&ca.SignCsrRequest{Csr: wcsr}) assert.Equal(t, "Unable to parse TTL: time: invalid duration abc", err.Error()) assert.Empty(t, wcert) }
explode_data.jsonl/73863
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 253 }
[ 2830, 3393, 10642, 1098, 622, 34, 15094, 1454, 68839, 51, 13470, 1155, 353, 8840, 836, 8, 341, 2109, 1669, 30446, 36934, 1155, 692, 25873, 1669, 6546, 515, 197, 197, 45548, 13636, 25, 330, 8301, 756, 197, 55242, 1695, 25, 257, 220, 17...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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 TestIsStringly(t *testing.T) { testCases := []struct { a interface{} ok bool val string }{ {Foo{}, true, fooStr}, {10, false, ""}, {"string", true, "string"}, {Bar{}, true, barStr}, } for _, tc := range testCases { tc := tc t.Run("Attr", func(t *testing.T) { t.Parallel() ok, val := isStringly(tc.a) if ok != tc.ok { t.Errorf("expected stringly: %v, got: %v", tc.ok, ok) } if val != tc.val { t.Errorf("expected val %s, got: %s", tc.val, val) } }) } }
explode_data.jsonl/81599
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 251 }
[ 2830, 3393, 3872, 703, 398, 1155, 353, 8840, 836, 8, 341, 18185, 37302, 1669, 3056, 1235, 341, 197, 11323, 256, 3749, 16094, 197, 59268, 220, 1807, 198, 197, 19302, 914, 198, 197, 59403, 197, 197, 90, 40923, 22655, 830, 11, 15229, 258...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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 TestDate(t *testing.T) { require := require.New(t) now := time.Now() v, err := Date.Convert(now) require.Nil(err) require.Equal(now.Format(DateLayout), v.(time.Time).Format(DateLayout)) v, err = Date.Convert(now.Format(DateLayout)) require.Nil(err) require.Equal( now.Format(DateLayout), v.(time.Time).Format(DateLayout), ) v, err = Date.Convert(now.Unix()) require.Nil(err) require.Equal( now.Format(DateLayout), v.(time.Time).Format(DateLayout), ) sql := Date.SQL(now) require.Equal([]byte(now.Format(DateLayout)), sql.Raw()) after := now.Add(time.Second) eq(t, Date, now, after) eq(t, Date, now, now) eq(t, Date, after, now) after = now.Add(26 * time.Hour) lt(t, Date, now, after) eq(t, Date, now, now) gt(t, Date, after, now) }
explode_data.jsonl/54303
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 326 }
[ 2830, 3393, 1916, 1155, 353, 8840, 836, 8, 341, 17957, 1669, 1373, 7121, 1155, 692, 80922, 1669, 882, 13244, 741, 5195, 11, 1848, 1669, 2631, 36179, 32263, 340, 17957, 59678, 3964, 340, 17957, 12808, 32263, 9978, 19987, 2175, 701, 348, ...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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 TestHTTPClientFailureDelete400(t *testing.T) { client := newHTTPClientFailureClient() result, err := client.Delete400(context.Background(), nil) if err == nil { t.Fatalf("Expected an error but did not receive one") } if !reflect.ValueOf(result).IsZero() { t.Fatalf("Expected a nil result") } }
explode_data.jsonl/54915
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 104 }
[ 2830, 3393, 9230, 2959, 17507, 6435, 19, 15, 15, 1155, 353, 8840, 836, 8, 341, 25291, 1669, 501, 9230, 2959, 17507, 2959, 741, 9559, 11, 1848, 1669, 2943, 18872, 19, 15, 15, 5378, 19047, 1507, 2092, 340, 743, 1848, 621, 2092, 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, 1...
3
func TestFilterVMs(t *testing.T) { vms := []vmDetails{ vmDetails{Zone: "us-central-1", Name: "app-central-as72"}, vmDetails{Zone: "us-west-1", Name: "db-west-09as"}, vmDetails{Zone: "eu-west-1", Name: "something-central-a7m2"}, } filtered := filterVMs(vms, "app") expectedVMs := []vmDetails{ vmDetails{Zone: "us-central-1", Name: "app-central-as72"}, } assert.Equal(t, expectedVMs, filtered) filtered = filterVMs(vms, "central") expectedVMs = []vmDetails{ vmDetails{Zone: "us-central-1", Name: "app-central-as72"}, vmDetails{Zone: "eu-west-1", Name: "something-central-a7m2"}, } assert.Equal(t, expectedVMs, filtered) }
explode_data.jsonl/13298
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 267 }
[ 2830, 3393, 5632, 11187, 82, 1155, 353, 8840, 836, 8, 341, 5195, 1011, 1669, 3056, 7338, 7799, 515, 197, 54879, 7799, 90, 15363, 25, 330, 355, 84081, 12, 16, 497, 3988, 25, 330, 676, 84081, 32434, 22, 17, 7115, 197, 54879, 7799, 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...
1
func TestCheckInvalidOptionalChainingNonOptional(t *testing.T) { _, err := ParseAndCheck(t, ` struct Test { let x: Int init(x: Int) { self.x = x } } let test = Test(x: 1) let x = test?.x `) errs := ExpectCheckerErrors(t, err, 1) assert.IsType(t, &sema.InvalidOptionalChainingError{}, errs[0]) }
explode_data.jsonl/34975
{ "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, 3973, 7928, 15309, 1143, 2056, 8121, 15309, 1155, 353, 8840, 836, 8, 1476, 197, 6878, 1848, 1669, 14775, 3036, 3973, 1155, 11, 22074, 414, 2036, 3393, 341, 688, 1077, 856, 25, 1333, 271, 688, 2930, 2075, 25, 1333, 8, 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...
1
func TestTerragruntGenerateAttr(t *testing.T) { t.Parallel() generateTestCase := filepath.Join(TEST_FIXTURE_CODEGEN_PATH, "generate-attr") cleanupTerraformFolder(t, generateTestCase) cleanupTerragruntFolder(t, generateTestCase) text := "test-terragrunt-generate-attr-hello-world" stdout, _, err := runTerragruntCommandWithOutput(t, fmt.Sprintf("terragrunt apply -auto-approve --terragrunt-non-interactive --terragrunt-working-dir %s -var text=\"%s\"", generateTestCase, text)) require.NoError(t, err) require.Contains(t, stdout, text) }
explode_data.jsonl/10159
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 209 }
[ 2830, 3393, 51402, 68305, 3850, 31115, 13371, 1155, 353, 8840, 836, 8, 341, 3244, 41288, 7957, 2822, 3174, 13220, 16458, 1669, 26054, 22363, 50320, 42635, 41486, 10020, 11085, 7944, 11, 330, 19366, 12, 2991, 1138, 1444, 60639, 51, 13886, ...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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 TestParseConfig(t *testing.T) { tests := []struct { name string js string want *LBConfig wantErr bool }{ { name: "empty json", js: "", want: nil, wantErr: true, }, { name: "OK with one discovery mechanism", js: testJSONConfig1, want: &LBConfig{ DiscoveryMechanisms: []DiscoveryMechanism{ { Cluster: testClusterName, LoadReportingServerName: newString(testLRSServer), MaxConcurrentRequests: newUint32(testMaxRequests), Type: DiscoveryMechanismTypeEDS, EDSServiceName: testEDSServcie, }, }, XDSLBPolicy: nil, }, wantErr: false, }, { name: "OK with multiple discovery mechanisms", js: testJSONConfig2, want: &LBConfig{ DiscoveryMechanisms: []DiscoveryMechanism{ { Cluster: testClusterName, LoadReportingServerName: newString(testLRSServer), MaxConcurrentRequests: newUint32(testMaxRequests), Type: DiscoveryMechanismTypeEDS, EDSServiceName: testEDSServcie, }, { Type: DiscoveryMechanismTypeLogicalDNS, }, }, XDSLBPolicy: nil, }, wantErr: false, }, { name: "OK with picking policy round_robin", js: testJSONConfig3, want: &LBConfig{ DiscoveryMechanisms: []DiscoveryMechanism{ { Cluster: testClusterName, LoadReportingServerName: newString(testLRSServer), MaxConcurrentRequests: newUint32(testMaxRequests), Type: DiscoveryMechanismTypeEDS, EDSServiceName: testEDSServcie, }, }, XDSLBPolicy: &internalserviceconfig.BalancerConfig{ Name: "ROUND_ROBIN", Config: nil, }, }, wantErr: false, }, { name: "OK with picking policy ring_hash", js: testJSONConfig4, want: &LBConfig{ DiscoveryMechanisms: []DiscoveryMechanism{ { Cluster: testClusterName, LoadReportingServerName: newString(testLRSServer), MaxConcurrentRequests: newUint32(testMaxRequests), Type: DiscoveryMechanismTypeEDS, EDSServiceName: testEDSServcie, }, }, XDSLBPolicy: &internalserviceconfig.BalancerConfig{ Name: ringhash.Name, Config: nil, }, }, wantErr: false, }, { name: "unsupported picking policy", js: testJSONConfig5, wantErr: true, }, } for _, tt := range tests { t.Run(tt.name, func(t *testing.T) { got, err := parseConfig([]byte(tt.js)) if (err != nil) != tt.wantErr { t.Fatalf("parseConfig() error = %v, wantErr %v", err, tt.wantErr) } if diff := cmp.Diff(got, tt.want); diff != "" { t.Errorf("parseConfig() got unexpected output, diff (-got +want): %v", diff) } }) } }
explode_data.jsonl/52608
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 1461 }
[ 2830, 3393, 14463, 2648, 1155, 353, 8840, 836, 8, 341, 78216, 1669, 3056, 1235, 341, 197, 11609, 262, 914, 198, 197, 95636, 414, 914, 198, 197, 50780, 262, 353, 34068, 2648, 198, 197, 50780, 7747, 1807, 198, 197, 59403, 197, 197, 515,...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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 TestExecCommand(t *testing.T) { if filter := flag.Lookup("test.run").Value.String(); filter != "ExecCommand" { t.Skip("use -run ExecCommand to execute a command via the test executable") } rootCmd.SetArgs(flag.Args()) require.NoError(t, rootCmd.Execute()) }
explode_data.jsonl/43715
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 90 }
[ 2830, 3393, 10216, 4062, 1155, 353, 8840, 836, 8, 341, 743, 4051, 1669, 5181, 79261, 445, 1944, 7634, 1827, 1130, 6431, 2129, 4051, 961, 330, 10216, 4062, 1, 341, 197, 3244, 57776, 445, 810, 481, 6108, 10290, 4062, 311, 9026, 264, 321...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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 TestV1ProtocolMessages(t *testing.T) { c1, c2, err := netPipe() if err != nil { t.Fatalf("netPipe: %v", err) } defer c1.Close() defer c2.Close() c := NewClient(c1) go ServeAgent(NewKeyring(), c2) testV1ProtocolMessages(t, c.(*client)) }
explode_data.jsonl/68409
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 117 }
[ 2830, 3393, 53, 16, 20689, 15820, 1155, 353, 8840, 836, 8, 341, 1444, 16, 11, 272, 17, 11, 1848, 1669, 4179, 34077, 741, 743, 1848, 961, 2092, 341, 197, 3244, 30762, 445, 4711, 34077, 25, 1018, 85, 497, 1848, 340, 197, 532, 16867, ...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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 TestGetPrefedTopologyParams(t *testing.T) { testCases := []struct { testCaseName string requestTopology []*csi.Topology expectedOutput map[string]string expectedError error }{ { testCaseName: "Valid preferred topology params", requestTopology: []*csi.Topology{{Segments: map[string]string{ utils.NodeRegionLabel: "us-south-test", utils.NodeZoneLabel: "testzone", }, }, }, expectedOutput: map[string]string{utils.NodeRegionLabel: "us-south-test", utils.NodeZoneLabel: "testzone", }, expectedError: nil, }, { testCaseName: "With nil preferred topology params", requestTopology: []*csi.Topology{}, expectedOutput: nil, expectedError: fmt.Errorf("preferred topologies specified but no segments"), }, } for _, testcase := range testCases { t.Run(testcase.testCaseName, func(t *testing.T) { actualCtlPubVol, err := getPrefedTopologyParams(testcase.requestTopology) if testcase.expectedError == nil { assert.Equal(t, testcase.expectedOutput, actualCtlPubVol) } else { assert.Equal(t, testcase.expectedError, err) } }) } }
explode_data.jsonl/51263
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 445 }
[ 2830, 3393, 1949, 29978, 291, 60954, 4870, 1155, 353, 8840, 836, 8, 341, 18185, 37302, 1669, 3056, 1235, 341, 197, 18185, 4207, 675, 262, 914, 198, 197, 23555, 60954, 29838, 63229, 17557, 2449, 198, 197, 42400, 5097, 220, 2415, 14032, 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...
2
func TestMacServiceImpl_FindMac(t *testing.T) { a := assert.New(t) ctrl := gomock.NewController(t) defer ctrl.Finish() mockMpr := database.NewMockMacRepository(ctrl) expected := make(model.Macs, 1) expected[0] = model.Mac{Name: "MacBook Pro"} { // success ipi := NewMacServiceImpl(mockMpr) if ipi == nil { t.FailNow() } mockMpr.EXPECT().FindMac(&model.MacRequestParam{}).Return(expected, nil) actual, err := ipi.Find(&model.MacRequestParam{}) a.NotNil(actual) a.NoError(err) a.Equal(expected, actual) } { // failed ipi := NewMacServiceImpl(mockMpr) if ipi == nil { t.FailNow() } mockMpr.EXPECT().FindMac(&model.MacRequestParam{}).Return(nil, fmt.Errorf("error")) actual, err := ipi.Find(&model.MacRequestParam{}) a.Nil(actual) a.Error(err) } }
explode_data.jsonl/55035
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 348 }
[ 2830, 3393, 19552, 50603, 95245, 19552, 1155, 353, 8840, 836, 8, 341, 11323, 1669, 2060, 7121, 1155, 340, 84381, 1669, 342, 316, 1176, 7121, 2051, 1155, 340, 16867, 23743, 991, 18176, 741, 77333, 44, 649, 1669, 4625, 7121, 11571, 19552, ...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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 TestNoOp_ExecuteOutbound(t *testing.T) { followup, _, err := (&noOp{}).ExecuteOutbound(nil, &metaData{}) require.Error(t, err) require.Nil(t, followup) }
explode_data.jsonl/66236
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 68 }
[ 2830, 3393, 2753, 7125, 83453, 2662, 10891, 1155, 353, 8840, 836, 8, 341, 1166, 1544, 454, 11, 8358, 1848, 1669, 15899, 2152, 7125, 6257, 568, 17174, 2662, 10891, 27907, 11, 609, 5490, 1043, 37790, 17957, 6141, 1155, 11, 1848, 340, 1795...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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 TestReconcilePVC(t *testing.T) { log := logrus.NewEntry(logrus.StandardLogger()) tests := []struct { name string kubernetescli kubernetes.Interface want []corev1.PersistentVolumeClaim }{ { name: "Should delete the prometheus PVCs", kubernetescli: fake.NewSimpleClientset(&corev1.PersistentVolumeClaim{ ObjectMeta: metav1.ObjectMeta{ Name: "prometheus-k8s-db-prometheus-k8s-0", Namespace: "openshift-monitoring", Labels: map[string]string{ "app": "prometheus", "prometheus": "k8s", }, }, }, &corev1.PersistentVolumeClaim{ ObjectMeta: metav1.ObjectMeta{ Name: "prometheus-k8s-db-prometheus-k8s-1", Namespace: "openshift-monitoring", Labels: map[string]string{ "app": "prometheus", "prometheus": "k8s", }, }, }), want: nil, }, { name: "Should preserve 1 pvc", kubernetescli: fake.NewSimpleClientset(&corev1.PersistentVolumeClaim{ ObjectMeta: metav1.ObjectMeta{ Name: "prometheus-k8s-db-prometheus-k8s-0", Namespace: "openshift-monitoring", Labels: map[string]string{ "app": "prometheus", "prometheus": "k8s", }, }, }, &corev1.PersistentVolumeClaim{ ObjectMeta: metav1.ObjectMeta{ Name: "random-pvc", Namespace: "openshift-monitoring", Labels: map[string]string{ "app": "random", }, }, }), want: []corev1.PersistentVolumeClaim{ { ObjectMeta: metav1.ObjectMeta{ Name: "random-pvc", Namespace: "openshift-monitoring", Labels: map[string]string{ "app": "random", }, }, }, }, }, } for _, tt := range tests { t.Run(tt.name, func(t *testing.T) { ctx := context.Background() r := &Reconciler{ log: log, kubernetescli: tt.kubernetescli, jsonHandle: new(codec.JsonHandle), } request := ctrl.Request{} request.Name = "cluster-monitoring-config" request.Namespace = "openshift-monitoring" _, err := r.Reconcile(ctx, request) if err != nil { t.Fatal(err) } pvcList, err := r.kubernetescli.CoreV1().PersistentVolumeClaims(monitoringName.Namespace).List(context.Background(), metav1.ListOptions{}) if err != nil { t.Fatalf("Unexpected error during list of PVCs: %v", err) } if !reflect.DeepEqual(pvcList.Items, tt.want) { t.Error(cmp.Diff(pvcList.Items, tt.want)) } }) } }
explode_data.jsonl/67190
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 1233 }
[ 2830, 3393, 693, 40446, 457, 47, 11287, 1155, 353, 8840, 836, 8, 341, 6725, 1669, 1487, 20341, 7121, 5874, 12531, 20341, 53615, 7395, 2398, 78216, 1669, 3056, 1235, 341, 197, 11609, 688, 914, 198, 197, 16463, 29827, 19521, 595, 29827, 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...
4
func TestPageRank(t *testing.T) { for i, test := range pageRankTests { g := concrete.NewDirectedGraph() for u, e := range test.g { // Add nodes that are not defined by an edge. if !g.Has(concrete.Node(u)) { g.AddNode(concrete.Node(u)) } for v := range e { g.SetEdge(concrete.Edge{F: concrete.Node(u), T: concrete.Node(v)}, 0) } } got := PageRank(g, test.damp, test.tol) prec := 1 - int(math.Log10(test.wantTol)) for n := range test.g { if !floats.EqualWithinAbsOrRel(got[n], test.want[n], test.wantTol, test.wantTol) { t.Errorf("unexpected PageRank result for test %d:\ngot: %v\nwant:%v", i, orderedFloats(got, prec), orderedFloats(test.want, prec)) break } } } }
explode_data.jsonl/28816
{ "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, 2665, 22550, 1155, 353, 8840, 836, 8, 341, 2023, 600, 11, 1273, 1669, 2088, 2150, 22550, 18200, 341, 197, 3174, 1669, 14175, 7121, 92669, 11212, 741, 197, 2023, 575, 11, 384, 1669, 2088, 1273, 1302, 341, 298, 197, 322, 269...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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 TestLoadJsonConfigWrongType(t *testing.T) { config,err:=loadJsonConfig("app_config.go") test.NotNil(t,err) test.Nil(t,config) test.StartWith(t,"Load Json Config fail",err.Error()) }
explode_data.jsonl/50971
{ "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, 5879, 5014, 2648, 29185, 929, 1155, 353, 8840, 836, 8, 341, 25873, 77911, 14209, 1078, 5014, 2648, 445, 676, 5332, 18002, 1138, 18185, 93882, 1155, 77911, 340, 18185, 59678, 1155, 11, 1676, 692, 18185, 12101, 2354, 1155, 1335,...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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 TestLoadFromString(t *testing.T) { p, err := LoadFromString(testOk) if err != nil { t.Error(err) t.Fail() return } assert.NotNil(t, p) assert.Equal(t, 2, p.ModelVersion) assert.NotNil(t, p.Content) assert.Equal(t, "Sheep_1", p.Content.Name) assert.Equal(t, 3, p.Content.Fps) assert.NotNil(t, p.Content.Layers) }
explode_data.jsonl/30010
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 156 }
[ 2830, 3393, 5879, 44491, 1155, 353, 8840, 836, 8, 341, 3223, 11, 1848, 1669, 8893, 44491, 8623, 11578, 340, 743, 1848, 961, 2092, 341, 197, 3244, 6141, 3964, 340, 197, 3244, 57243, 741, 197, 853, 198, 197, 532, 6948, 93882, 1155, 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 TestWeightedAcquire(t *testing.T) { t.Parallel() ctx := context.Background() sem := semaphore.NewWeighted(2) tryAcquire := func(n int64) bool { ctx, cancel := context.WithTimeout(ctx, 10*time.Millisecond) defer cancel() return sem.Acquire(ctx, n) == nil } tries := []bool{} sem.Acquire(ctx, 1) tries = append(tries, tryAcquire(1)) tries = append(tries, tryAcquire(1)) sem.Release(2) tries = append(tries, tryAcquire(1)) sem.Acquire(ctx, 1) tries = append(tries, tryAcquire(1)) want := []bool{true, false, true, false} for i := range tries { if tries[i] != want[i] { t.Errorf("tries[%d]: got %t, want %t", i, tries[i], want[i]) } } }
explode_data.jsonl/56019
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 286 }
[ 2830, 3393, 8295, 291, 11654, 984, 1155, 353, 8840, 836, 8, 341, 3244, 41288, 7957, 2822, 20985, 1669, 2266, 19047, 741, 89527, 1669, 55918, 7121, 8295, 291, 7, 17, 340, 6799, 11654, 984, 1669, 2915, 1445, 526, 21, 19, 8, 1807, 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...
1
func TestExpiredProof(t *testing.T) { seed, _ := SeedFromString("65fd6c247d843cd80827a7a24cf01e1fbb697bd9e255fa259b745be24fe5bdce944c02b24d3a86b2c6460111f2876a88") pub, _ := crypto.PublicKeyFromString("7002d6264285782be3ea70f231b123330ace6c6dc0b70a80fef4271e9379da2c60f63554e99bbf55877744c218e09a183368703ad432cc0a4b73509050f4a31695fc525468feee379339bd61fbc4b54d49ef997618be7c51c1ac3fd4ea185d97") proof, _ := ProofFromString("70e4951675331ce0bba3701f9c442889a6ff7b8364af1174cec27dedcbc90cfc9da1cf920ad6af64ffe70d9cfe826a0c") poolStake := int64(884 * 1e8) s := NewSortition() h := crypto.GenerateTestHash() s.SetParams(h, seed, poolStake) for i := 0; i < 3; i++ { s.SetParams(crypto.GenerateTestHash(), GenerateRandomSeed(), poolStake) } assert.True(t, s.VerifyProof(h, proof, pub, 21*1e8), "Sortition is valid") for i := 0; i < 4; i++ { s.SetParams(crypto.GenerateTestHash(), GenerateRandomSeed(), poolStake) } assert.False(t, s.VerifyProof(h, proof, pub, 21*1e8), "Sortition expired") }
explode_data.jsonl/47753
{ "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, 54349, 31076, 1155, 353, 8840, 836, 8, 341, 197, 22602, 11, 716, 1669, 35822, 44491, 445, 21, 20, 6902, 21, 66, 17, 19, 22, 67, 23, 19, 18, 4385, 23, 15, 23, 17, 22, 64, 22, 64, 17, 19, 9792, 15, 16, 68, 16, 69, ...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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 TestChangefeedBasics(t *testing.T) { defer leaktest.AfterTest(t)() testFn := func(t *testing.T, db *gosql.DB, f cdctest.TestFeedFactory) { sqlDB := sqlutils.MakeSQLRunner(db) sqlDB.Exec(t, `CREATE TABLE foo (a INT PRIMARY KEY, b STRING)`) sqlDB.Exec(t, `INSERT INTO foo VALUES (0, 'initial')`) sqlDB.Exec(t, `UPSERT INTO foo VALUES (0, 'updated')`) foo := feed(t, f, `CREATE CHANGEFEED FOR foo`) defer closeFeed(t, foo) // 'initial' is skipped because only the latest value ('updated') is // emitted by the initial scan. assertPayloads(t, foo, []string{ `foo: [0]->{"after": {"a": 0, "b": "updated"}}`, }) sqlDB.Exec(t, `INSERT INTO foo VALUES (1, 'a'), (2, 'b')`) assertPayloads(t, foo, []string{ `foo: [1]->{"after": {"a": 1, "b": "a"}}`, `foo: [2]->{"after": {"a": 2, "b": "b"}}`, }) sqlDB.Exec(t, `UPSERT INTO foo VALUES (2, 'c'), (3, 'd')`) assertPayloads(t, foo, []string{ `foo: [2]->{"after": {"a": 2, "b": "c"}}`, `foo: [3]->{"after": {"a": 3, "b": "d"}}`, }) sqlDB.Exec(t, `DELETE FROM foo WHERE a = 1`) assertPayloads(t, foo, []string{ `foo: [1]->{"after": null}`, }) } t.Run(`sinkless`, sinklessTest(testFn)) t.Run(`enterprise`, enterpriseTest(testFn)) t.Run(`cloudstorage`, cloudStorageTest(testFn)) // NB running TestChangefeedBasics, which includes a DELETE, with // cloudStorageTest is a regression test for #36994. }
explode_data.jsonl/7032
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 618 }
[ 2830, 3393, 1143, 524, 823, 12051, 33603, 1211, 1155, 353, 8840, 836, 8, 341, 16867, 23352, 1944, 36892, 2271, 1155, 8, 2822, 18185, 24911, 1669, 2915, 1155, 353, 8840, 836, 11, 2927, 353, 34073, 1470, 22537, 11, 282, 15307, 67880, 8787...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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 TestGameServerAllocationPreferredSelection(t *testing.T) { t.Parallel() fleets := framework.AgonesClient.AgonesV1().Fleets(defaultNs) gameServers := framework.AgonesClient.AgonesV1().GameServers(defaultNs) label := map[string]string{"role": t.Name()} preferred := defaultFleet(defaultNs) preferred.ObjectMeta.GenerateName = "preferred-" preferred.Spec.Replicas = 1 preferred.Spec.Template.ObjectMeta.Labels = label preferred, err := fleets.Create(preferred) if assert.Nil(t, err) { defer fleets.Delete(preferred.ObjectMeta.Name, nil) // nolint:errcheck } else { assert.FailNow(t, "could not create first fleet") } required := defaultFleet(defaultNs) required.ObjectMeta.GenerateName = "required-" required.Spec.Replicas = 2 required.Spec.Template.ObjectMeta.Labels = label required, err = fleets.Create(required) if assert.Nil(t, err) { defer fleets.Delete(required.ObjectMeta.Name, nil) // nolint:errcheck } else { assert.FailNow(t, "could not create second fleet") } framework.AssertFleetCondition(t, preferred, e2e.FleetReadyCount(preferred.Spec.Replicas)) framework.AssertFleetCondition(t, required, e2e.FleetReadyCount(required.Spec.Replicas)) gsa := &allocationv1.GameServerAllocation{ObjectMeta: metav1.ObjectMeta{GenerateName: "allocation-"}, Spec: allocationv1.GameServerAllocationSpec{ Required: metav1.LabelSelector{MatchLabels: label}, Preferred: []metav1.LabelSelector{ {MatchLabels: map[string]string{agonesv1.FleetNameLabel: preferred.ObjectMeta.Name}}, }, }} gsa1, err := framework.AgonesClient.AllocationV1().GameServerAllocations(defaultNs).Create(gsa.DeepCopy()) if assert.Nil(t, err) { assert.Equal(t, allocationv1.GameServerAllocationAllocated, gsa1.Status.State) gs, err := gameServers.Get(gsa1.Status.GameServerName, metav1.GetOptions{}) assert.Nil(t, err) assert.Equal(t, preferred.ObjectMeta.Name, gs.ObjectMeta.Labels[agonesv1.FleetNameLabel]) } else { assert.FailNow(t, "could not completed gsa1 allocation") } gs2, err := framework.AgonesClient.AllocationV1().GameServerAllocations(defaultNs).Create(gsa.DeepCopy()) if assert.Nil(t, err) { assert.Equal(t, allocationv1.GameServerAllocationAllocated, gs2.Status.State) gs, err := gameServers.Get(gs2.Status.GameServerName, metav1.GetOptions{}) assert.Nil(t, err) assert.Equal(t, required.ObjectMeta.Name, gs.ObjectMeta.Labels[agonesv1.FleetNameLabel]) } else { assert.FailNow(t, "could not completed gs2 allocation") } // delete the preferred gameserver, and then let's try allocating again, make sure it goes back to the // preferred one err = gameServers.Delete(gsa1.Status.GameServerName, nil) if !assert.Nil(t, err) { assert.FailNow(t, "could not delete gameserver") } // wait until the game server is deleted err = wait.PollImmediate(time.Second, 5*time.Minute, func() (bool, error) { _, err = gameServers.Get(gsa1.Status.GameServerName, metav1.GetOptions{}) if err != nil && errors.IsNotFound(err) { return true, nil } return false, err }) assert.Nil(t, err) // now wait for another one to come along framework.AssertFleetCondition(t, preferred, e2e.FleetReadyCount(preferred.Spec.Replicas)) gsa3, err := framework.AgonesClient.AllocationV1().GameServerAllocations(defaultNs).Create(gsa.DeepCopy()) if assert.Nil(t, err) { assert.Equal(t, allocationv1.GameServerAllocationAllocated, gsa3.Status.State) gs, err := gameServers.Get(gsa3.Status.GameServerName, metav1.GetOptions{}) assert.Nil(t, err) assert.Equal(t, preferred.ObjectMeta.Name, gs.ObjectMeta.Labels[agonesv1.FleetNameLabel]) } }
explode_data.jsonl/63310
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 1309 }
[ 2830, 3393, 4868, 5475, 78316, 22482, 11177, 1155, 353, 8840, 836, 8, 341, 3244, 41288, 7957, 2822, 1166, 273, 1415, 1669, 12626, 49850, 3154, 2959, 49850, 3154, 53, 16, 1005, 37, 273, 1415, 18978, 47360, 340, 30677, 78139, 1669, 12626, ...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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 TestDeflateInflateString(t *testing.T) { t.Parallel() if testing.Short() && testenv.Builder() == "" { t.Skip("skipping in short mode") } for _, test := range deflateInflateStringTests { gold, err := ioutil.ReadFile(test.filename) if err != nil { t.Error(err) } testToFromWithLimit(t, gold, test.label, test.limit) if testing.Short() { break } } }
explode_data.jsonl/81408
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 156 }
[ 2830, 3393, 2620, 5075, 641, 16716, 703, 1155, 353, 8840, 836, 8, 341, 3244, 41288, 7957, 741, 743, 7497, 55958, 368, 1009, 1273, 3160, 15641, 368, 621, 1591, 341, 197, 3244, 57776, 445, 4886, 5654, 304, 2805, 3856, 1138, 197, 532, 20...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
6
func TestTRaft_AddLog(t *testing.T) { ta := require.New(t) id := int64(1) tr := NewTRaft(id, map[int64]string{id: "123"}) tr.AddLog(NewCmdI64("set", "x", 1)) ta.Equal("[<000#001:000{set(x, 1)}-0:1→0>]", RecordsShortStr(tr.Logs)) tr.AddLog(NewCmdI64("set", "y", 1)) ta.Equal(join( "[<000#001:000{set(x, 1)}-0:1→0>", "<000#001:001{set(y, 1)}-0:2→0>]"), RecordsShortStr(tr.Logs, "")) tr.AddLog(NewCmdI64("set", "x", 1)) ta.Equal(join( "[<000#001:000{set(x, 1)}-0:1→0>", "<000#001:001{set(y, 1)}-0:2→0>", "<000#001:002{set(x, 1)}-0:5→0>]"), RecordsShortStr(tr.Logs, "")) varnames := "wxyz" for i := 0; i < 67; i++ { vi := i % len(varnames) tr.AddLog(NewCmdI64("set", varnames[vi:vi+1], int64(i))) } l := len(tr.Logs) ta.Equal("<000#001:069{set(y, 66)}-0:2222222222222222:22→0>", tr.Logs[l-1].ShortStr()) // truncate some logs, then add another 67 // To check Overrides and Depends tr.LogOffset = 65 tr.Logs = tr.Logs[65:] for i := 0; i < 67; i++ { vi := i % len(varnames) tr.AddLog(NewCmdI64("set", varnames[vi:vi+1], 100+int64(i))) } l = len(tr.Logs) ta.Equal("<000#001:136{set(y, 166)}-64:1111111111111122:111→64:1>", tr.Logs[l-1].ShortStr()) }
explode_data.jsonl/17383
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 616 }
[ 2830, 3393, 2378, 64, 723, 21346, 2201, 1155, 353, 8840, 836, 8, 1476, 197, 2565, 1669, 1373, 7121, 1155, 692, 15710, 1669, 526, 21, 19, 7, 16, 340, 25583, 1669, 1532, 2378, 64, 723, 3724, 11, 2415, 18640, 21, 19, 30953, 61761, 25, ...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
3
func TestPropagateConflict(t *testing.T) { tests := []struct { name string forest string // inNamespace contains the namespaces we are creating the objects in inNamespace string // noPropagation contains the namespaces where the objects would have a noneSelector noPropogation string allow bool errContain string }{{ name: "Objects with the same name existing in namespaces that one is not an ancestor of the other would not cause overwriting conflict", forest: "-aa", inNamespace: "bc", allow: true, }, { name: "Objects with the same name existing in namespaces that one is an ancestor of the other would have overwriting conflict", forest: "-aa", inNamespace: "ab", allow: false, }, { name: "Should not cause a conflict if the object in the parent namespace has an exceptions selector that choose not to propagate to the conflicting child namespace", forest: "-aa", inNamespace: "ab", noPropogation: "a", allow: true, }, { name: "Should identify the real conflicting source when there are multiple conflicting sources but only one gets propagated", forest: "-ab", inNamespace: "abc", noPropogation: "a", allow: false, errContain: "Object \"my-creds\" in namespace \"b\" would overwrite the one in \"c\"", }} for _, tc := range tests { t.Run(tc.name, func(t *testing.T) { g := NewWithT(t) configs := []api.ResourceSpec{ {Group: "", Resource: "secrets", Mode: "Propagate"}} c := &api.HNCConfiguration{Spec: api.HNCConfigurationSpec{Resources: configs}} c.Name = api.HNCConfigSingleton f := foresttest.Create(tc.forest) config := &HNCConfig{ translator: fakeGRTranslator{}, Forest: f, Log: zap.New(), } // Add source objects to the forest. for _, ns := range tc.inNamespace { inst := &unstructured.Unstructured{} inst.SetGroupVersionKind(schema.GroupVersionKind{Group: "", Version: "v1", Kind: "Secret"}) inst.SetName("my-creds") if strings.Contains(tc.noPropogation, string(ns)) { inst.SetAnnotations(map[string]string{api.AnnotationNoneSelector: "true"}) } f.Get(string(ns)).SetSourceObject(inst) } got := config.handle(context.Background(), c) logResult(t, got.AdmissionResponse.Result) g.Expect(got.AdmissionResponse.Allowed).Should(Equal(tc.allow)) if tc.errContain != "" { g.Expect(strings.Contains(got.AdmissionResponse.Result.Message, tc.errContain)) } }) } }
explode_data.jsonl/11113
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 987 }
[ 2830, 3393, 2008, 46836, 57974, 1155, 353, 8840, 836, 8, 341, 78216, 1669, 3056, 1235, 341, 197, 11609, 256, 914, 198, 197, 1166, 41419, 914, 198, 197, 197, 322, 304, 22699, 5610, 279, 58091, 582, 525, 6825, 279, 6171, 304, 198, 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...
4
func TestGetRandomJSON(t *testing.T) { ctx := context.Background() t.Run("database query succeeded", func(t *testing.T) { db := &tests.DBMock{} db.On("QueryRow", ctx, getRandomPkgsDBQ).Return([]byte("dataJSON"), nil) m := NewManager(db) dataJSON, err := m.GetRandomJSON(ctx) assert.NoError(t, err) assert.Equal(t, []byte("dataJSON"), dataJSON) db.AssertExpectations(t) }) t.Run("database error", func(t *testing.T) { db := &tests.DBMock{} db.On("QueryRow", ctx, getRandomPkgsDBQ).Return(nil, tests.ErrFakeDB) m := NewManager(db) dataJSON, err := m.GetRandomJSON(ctx) assert.Equal(t, tests.ErrFakeDB, err) assert.Nil(t, dataJSON) db.AssertExpectations(t) }) }
explode_data.jsonl/74681
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 296 }
[ 2830, 3393, 1949, 13999, 5370, 1155, 353, 8840, 836, 8, 341, 20985, 1669, 2266, 19047, 2822, 3244, 16708, 445, 12216, 3239, 25331, 497, 2915, 1155, 353, 8840, 836, 8, 341, 197, 20939, 1669, 609, 23841, 22537, 11571, 16094, 197, 20939, 8...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
1
func TestDisconnectAPI(t *testing.T) { node := nodeWithMemoryEngine() ruleConfig := rule.DefaultConfig ruleContainer := rule.NewContainer(ruleConfig) api := NewExecutor(node, ruleContainer, "test") resp := api.Disconnect(context.Background(), &DisconnectRequest{}) require.Equal(t, ErrorBadRequest, resp.Error) resp = api.Disconnect(context.Background(), &DisconnectRequest{ User: "test", }) require.Nil(t, resp.Error) }
explode_data.jsonl/48465
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 140 }
[ 2830, 3393, 60651, 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, 6958, ...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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 TestCreateToken(t *testing.T) { type args struct { signingKey []byte user string expiresInSeconds int } tests := []struct { name string args args want string wantErr bool }{ { name: "default", args: args{ signingKey: []byte("abcdefg"), user: "testuser", expiresInSeconds: 10, }, want: "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJleHAiOjE2NDQ0NTMyODIsInN1YiI6InRlc3R1c2VyIn0.", wantErr: false, }, } for _, tt := range tests { t.Run(tt.name, func(t *testing.T) { got, err := createToken(tt.args.signingKey, tt.args.user, tt.args.expiresInSeconds) if (err != nil) != tt.wantErr { t.Errorf("createToken() error = %v, wantErr %v", err, tt.wantErr) return } if strings.HasPrefix(got, tt.want) { t.Errorf("createToken() = %v, want %v", got, tt.want) } }) } }
explode_data.jsonl/80895
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 469 }
[ 2830, 3393, 4021, 3323, 1155, 353, 8840, 836, 8, 341, 13158, 2827, 2036, 341, 197, 69054, 287, 1592, 981, 3056, 3782, 198, 197, 19060, 1797, 914, 198, 197, 8122, 18968, 96236, 526, 198, 197, 532, 78216, 1669, 3056, 1235, 341, 197, 116...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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 TestPollServiceInstanceClusterServiceBrokerTemporaryError(t *testing.T) { fakeKubeClient, fakeCatalogClient, fakeClusterServiceBrokerClient, testController, sharedInformers := newTestController(t, fakeosb.FakeClientConfiguration{ PollLastOperationReaction: &fakeosb.PollLastOperationReaction{ Error: osb.HTTPStatusCodeError{ StatusCode: http.StatusForbidden, }, }, }) sharedInformers.ClusterServiceBrokers().Informer().GetStore().Add(getTestClusterServiceBroker()) sharedInformers.ClusterServiceClasses().Informer().GetStore().Add(getTestClusterServiceClass()) sharedInformers.ClusterServicePlans().Informer().GetStore().Add(getTestClusterServicePlan()) instance := getTestServiceInstanceAsyncDeprovisioning(testOperation) instanceKey := testNamespace + "/" + testServiceInstanceName if testController.instancePollingQueue.NumRequeues(instanceKey) != 0 { t.Fatalf("Expected polling queue to not have any record of test instance") } err := testController.pollServiceInstance(instance) if err == nil { t.Fatal("Expected pollServiceInstance to return error") } expectedErr := "Error polling last operation: Status: 403; ErrorMessage: <nil>; Description: <nil>; ResponseError: <nil>" if e, a := expectedErr, err.Error(); e != a { t.Fatalf("unexpected error returned: expected %q, got %q", e, a) } brokerActions := fakeClusterServiceBrokerClient.Actions() assertNumberOfBrokerActions(t, brokerActions, 1) operationKey := osb.OperationKey(testOperation) assertPollLastOperation(t, brokerActions[0], &osb.LastOperationRequest{ InstanceID: testServiceInstanceGUID, ServiceID: strPtr(testClusterServiceClassGUID), PlanID: strPtr(testClusterServicePlanGUID), OperationKey: &operationKey, }) // verify no kube resources created. // No actions kubeActions := fakeKubeClient.Actions() assertNumberOfActions(t, kubeActions, 0) actions := fakeCatalogClient.Actions() assertNumberOfActions(t, actions, 1) assertUpdateStatus(t, actions[0], instance) events := getRecordedEvents(testController) expectedEvent := warningEventBuilder(errorPollingLastOperationReason).msg( "Error polling last operation:", ).msg("Status: 403; ErrorMessage: <nil>; Description: <nil>; ResponseError: <nil>") if err := checkEvents(events, expectedEvent.stringArr()); err != nil { t.Fatal(err) } }
explode_data.jsonl/58166
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 742 }
[ 2830, 3393, 49207, 1860, 2523, 28678, 1860, 65545, 59362, 1454, 1155, 353, 8840, 836, 8, 341, 1166, 726, 42, 3760, 2959, 11, 12418, 41606, 2959, 11, 12418, 28678, 1860, 65545, 2959, 11, 1273, 2051, 11, 6094, 37891, 388, 1669, 501, 2271,...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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 TestBackupRestoreSequence(t *testing.T) { defer leaktest.AfterTest(t)() const numAccounts = 1 _, _, origDB, dir, cleanupFn := BackupRestoreTestSetup(t, singleNode, numAccounts, InitNone) defer cleanupFn() args := base.TestServerArgs{ExternalIODir: dir} backupLoc := LocalFoo origDB.Exec(t, `CREATE SEQUENCE data.t_id_seq`) origDB.Exec(t, `CREATE TABLE data.t (id INT PRIMARY KEY DEFAULT nextval('data.t_id_seq'), v text)`) origDB.Exec(t, `INSERT INTO data.t (v) VALUES ('foo'), ('bar'), ('baz')`) origDB.Exec(t, `BACKUP DATABASE data TO $1`, backupLoc) t.Run("restore both table & sequence to a new cluster", func(t *testing.T) { tc := testcluster.StartTestCluster(t, singleNode, base.TestClusterArgs{ServerArgs: args}) defer tc.Stopper().Stop(context.Background()) newDB := sqlutils.MakeSQLRunner(tc.Conns[0]) newDB.Exec(t, `RESTORE DATABASE data FROM $1`, backupLoc) newDB.Exec(t, `USE data`) // Verify that the db was restored correctly. newDB.CheckQueryResults(t, `SELECT * FROM t`, [][]string{ {"1", "foo"}, {"2", "bar"}, {"3", "baz"}, }) newDB.CheckQueryResults(t, `SELECT last_value FROM t_id_seq`, [][]string{ {"3"}, }) // Verify that we can kkeep inserting into the table, without violating a uniqueness constraint. newDB.Exec(t, `INSERT INTO data.t (v) VALUES ('bar')`) // Verify that sequence <=> table dependencies are still in place. newDB.ExpectErr( t, "pq: cannot drop sequence t_id_seq because other objects depend on it", `DROP SEQUENCE t_id_seq`, ) }) t.Run("restore just the table to a new cluster", func(t *testing.T) { tc := testcluster.StartTestCluster(t, singleNode, base.TestClusterArgs{ServerArgs: args}) defer tc.Stopper().Stop(context.Background()) newDB := sqlutils.MakeSQLRunner(tc.Conns[0]) newDB.Exec(t, `CREATE DATABASE data`) newDB.Exec(t, `USE data`) newDB.ExpectErr( t, "pq: cannot restore table \"t\" without referenced sequence 54 \\(or \"skip_missing_sequences\" option\\)", `RESTORE TABLE t FROM $1`, LocalFoo, ) newDB.Exec(t, `RESTORE TABLE t FROM $1 WITH OPTIONS ('skip_missing_sequences')`, LocalFoo) // Verify that the table was restored correctly. newDB.CheckQueryResults(t, `SELECT * FROM data.t`, [][]string{ {"1", "foo"}, {"2", "bar"}, {"3", "baz"}, }) // Test that insertion without specifying the id column doesn't work, since // the DEFAULT expression has been removed. newDB.ExpectErr( t, `pq: missing \"id\" primary key column`, `INSERT INTO t (v) VALUES ('bloop')`, ) // Test that inserting with a value specified works. newDB.Exec(t, `INSERT INTO t (id, v) VALUES (4, 'bloop')`) }) t.Run("restore just the sequence to a new cluster", func(t *testing.T) { tc := testcluster.StartTestCluster(t, singleNode, base.TestClusterArgs{ServerArgs: args}) defer tc.Stopper().Stop(context.Background()) newDB := sqlutils.MakeSQLRunner(tc.Conns[0]) newDB.Exec(t, `CREATE DATABASE data`) newDB.Exec(t, `USE data`) // TODO(vilterp): create `RESTORE SEQUENCE` instead of `RESTORE TABLE`, and force // people to use that? newDB.Exec(t, `RESTORE TABLE t_id_seq FROM $1`, backupLoc) // Verify that the sequence value was restored. newDB.CheckQueryResults(t, `SELECT last_value FROM data.t_id_seq`, [][]string{ {"3"}, }) // Verify that the reference to the table that used it was removed, and // it can be dropped. newDB.Exec(t, `DROP SEQUENCE t_id_seq`) }) }
explode_data.jsonl/57616
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 1327 }
[ 2830, 3393, 56245, 56284, 14076, 1155, 353, 8840, 836, 8, 341, 16867, 23352, 1944, 36892, 2271, 1155, 8, 741, 4777, 1629, 41369, 284, 220, 16, 198, 197, 6878, 8358, 2713, 3506, 11, 5419, 11, 21290, 24911, 1669, 43438, 56284, 2271, 21821...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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 TestMatConvert(t *testing.T) { src := NewMatWithSize(100, 100, MatTypeCV32F) dst := NewMat() src.ConvertTo(&dst, MatTypeCV16S) if dst.Empty() { t.Error("TestConvert dst should not be empty.") } }
explode_data.jsonl/81697
{ "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, 11575, 12012, 1155, 353, 8840, 836, 8, 341, 41144, 1669, 1532, 11575, 2354, 1695, 7, 16, 15, 15, 11, 220, 16, 15, 15, 11, 6867, 929, 19589, 18, 17, 37, 340, 52051, 1669, 1532, 11575, 741, 41144, 36179, 1249, 2099, 15658,...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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 TestFileGetFile(t *testing.T) { path, tearDown := setupConfigFile(t, minimalConfig) defer tearDown() fs, err := config.NewFileStore(path, true) require.NoError(t, err) defer fs.Close() t.Run("get empty filename", func(t *testing.T) { _, err := fs.GetFile("") require.Error(t, err) }) t.Run("get non-existent file", func(t *testing.T) { _, err := fs.GetFile("unknown") require.Error(t, err) }) t.Run("get empty file", func(t *testing.T) { err := os.MkdirAll("config", 0700) require.NoError(t, err) f, err := ioutil.TempFile("config", "empty-file") require.NoError(t, err) defer os.Remove(f.Name()) err = ioutil.WriteFile(f.Name(), nil, 0777) require.NoError(t, err) data, err := fs.GetFile(f.Name()) require.NoError(t, err) require.Empty(t, data) }) t.Run("get non-empty file", func(t *testing.T) { err := os.MkdirAll("config", 0700) require.NoError(t, err) f, err := ioutil.TempFile("config", "test-file") require.NoError(t, err) defer os.Remove(f.Name()) err = ioutil.WriteFile(f.Name(), []byte("test"), 0777) require.NoError(t, err) data, err := fs.GetFile(f.Name()) require.NoError(t, err) require.Equal(t, []byte("test"), data) }) t.Run("get via absolute path", func(t *testing.T) { err := fs.SetFile("new", []byte("new file")) require.NoError(t, err) data, err := fs.GetFile(filepath.Join(filepath.Dir(path), "new")) require.NoError(t, err) require.Equal(t, []byte("new file"), data) }) }
explode_data.jsonl/32385
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 628 }
[ 2830, 3393, 1703, 1949, 1703, 1155, 353, 8840, 836, 8, 341, 26781, 11, 32825, 1669, 6505, 2648, 1703, 1155, 11, 17377, 2648, 340, 16867, 32825, 2822, 53584, 11, 1848, 1669, 2193, 7121, 1703, 6093, 5581, 11, 830, 340, 17957, 35699, 1155,...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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 TestExecuteTimeout(t *testing.T) { _, cs, cleanup, err := initMockPeer("testchannel") assert.NoError(t, err) defer cleanup() tests := []struct { executeTimeout time.Duration installTimeout time.Duration namespace string command string expectedTimeout time.Duration }{ { executeTimeout: time.Second, installTimeout: time.Minute, namespace: "lscc", command: "install", expectedTimeout: time.Minute, }, { executeTimeout: time.Minute, installTimeout: time.Second, namespace: "lscc", command: "install", expectedTimeout: time.Minute, }, { executeTimeout: time.Second, installTimeout: time.Minute, namespace: "_lifecycle", command: "InstallChaincode", expectedTimeout: time.Minute, }, { executeTimeout: time.Minute, installTimeout: time.Second, namespace: "_lifecycle", command: "InstallChaincode", expectedTimeout: time.Minute, }, { executeTimeout: time.Second, installTimeout: time.Minute, namespace: "_lifecycle", command: "anything", expectedTimeout: time.Second, }, { executeTimeout: time.Second, installTimeout: time.Minute, namespace: "lscc", command: "anything", expectedTimeout: time.Second, }, { executeTimeout: time.Second, installTimeout: time.Minute, namespace: "anything", command: "", expectedTimeout: time.Second, }, } for _, tt := range tests { t.Run(tt.namespace+"_"+tt.command, func(t *testing.T) { cs.ExecuteTimeout = tt.executeTimeout cs.InstallTimeout = tt.installTimeout input := &pb.ChaincodeInput{Args: util.ToChaincodeArgs(tt.command)} result := cs.executeTimeout(tt.namespace, input) assert.Equalf(t, tt.expectedTimeout, result, "want %s, got %s", tt.expectedTimeout, result) }) } }
explode_data.jsonl/58391
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 823 }
[ 2830, 3393, 17174, 7636, 1155, 353, 8840, 836, 8, 341, 197, 6878, 10532, 11, 21290, 11, 1848, 1669, 2930, 11571, 30888, 445, 1944, 10119, 1138, 6948, 35699, 1155, 11, 1848, 340, 16867, 21290, 2822, 78216, 1669, 3056, 1235, 341, 197, 812...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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 TestNewSpear(t *testing.T) { _, err := NewSpear("", "", false, identifier.DatastoreAllocate{}, validator.New()) require.Error(t, err) _, err = NewSpear("+", "test", false, identifier.DatastoreAllocate{}, validator.New()) require.Error(t, err) ss, err := NewSpear("", "test", false, identifier.DatastoreAllocate{}, validator.New()) require.NoError(t, err) assert.NotNil(t, ss) }
explode_data.jsonl/13756
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 148 }
[ 2830, 3393, 3564, 50, 8015, 1155, 353, 8840, 836, 8, 341, 197, 6878, 1848, 1669, 1532, 50, 8015, 19814, 7342, 895, 11, 12816, 3336, 4314, 75380, 22655, 22935, 7121, 2398, 17957, 6141, 1155, 11, 1848, 340, 197, 6878, 1848, 284, 1532, 5...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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 TestValidatePipelineResults_Failure(t *testing.T) { tests := []struct { name string results []PipelineResult }{{ name: "invalid pipeline result reference", results: []PipelineResult{{ Name: "my-pipeline-result", Description: "this is my pipeline result", Value: "$(tasks.a-task.results.output.output)", }}, }} for _, tt := range tests { t.Run(tt.name, func(t *testing.T) { err := validatePipelineResults(tt.results) if err == nil { t.Error("Pipeline.validatePipelineResults() did not return error, wanted error") } }) } }
explode_data.jsonl/26536
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 237 }
[ 2830, 3393, 17926, 34656, 9801, 1400, 9373, 1155, 353, 8840, 836, 8, 341, 78216, 1669, 3056, 1235, 341, 197, 11609, 262, 914, 198, 197, 55497, 3056, 34656, 2077, 198, 197, 15170, 515, 197, 11609, 25, 330, 11808, 15301, 1102, 5785, 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...
2
func Test_nodeImages(t *testing.T) { node := testutil.CreateNode("node-1") node.Status.Images = []corev1.ContainerImage{ { Names: []string{"a"}, SizeBytes: 10, }, { Names: []string{"b-1", "b-2"}, SizeBytes: 10, }, } got, err := nodeImages(node) require.NoError(t, err) expected := component.NewTableWithRows("Images", "There are no images!", nodeImagesColumns, []component.TableRow{ { "Names": component.NewMarkdownText("a"), "Size": component.NewText("10"), }, { "Names": component.NewMarkdownText("b-1\nb-2"), "Size": component.NewText("10"), }, }) component.AssertEqual(t, expected, got) }
explode_data.jsonl/13603
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 274 }
[ 2830, 3393, 5084, 14228, 1155, 353, 8840, 836, 8, 1476, 20831, 1669, 1273, 1314, 7251, 1955, 445, 3509, 12, 16, 1138, 20831, 10538, 47188, 284, 3056, 98645, 16, 33672, 1906, 515, 197, 197, 515, 298, 197, 7980, 25, 257, 3056, 917, 4913...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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 TestMiddlewareFail(t *testing.T) { logbuf := bytes.NewBuffer(nil) logger := log.New(logbuf, "", 0) router := chi.NewRouter() type Data struct { ID uuid.UUID `path:"id"` Name string `json:"name"` Part string `query:"part"` Priority uint8 `json:"priority"` Null string `json:"-"` Hero string } router.With( Middleware(Data{}, WithLogger(logger), WithInterrupt(400), WithOnError( func(err *Error, w http.ResponseWriter, req *http.Request) bool { assert.Equal(t, "id", err.Tag()) assert.Equal(t, "path", err.Part()) assert.Equal(t, "bad-uuid", err.Source()) return false }, )), ).Put("/user/{id}/name", func(w http.ResponseWriter, r *http.Request) { require.Fail(t, "request should be interrupted") }) body := bytes.NewBufferString(`{"name": "John", "priority": 5, "Hero": "Joker"}`) req := httptest.NewRequest(http.MethodPut, "/user/bad-uuid/name?part=last", body) res := httptest.NewRecorder() router.ServeHTTP(res, req) assert.Equal(t, 400, res.Code) assert.Equal(t, "path[id](bad-uuid): uuid: incorrect UUID length: bad-uuid\n", res.Body.String()) assert.Contains(t, logbuf.String(), "path[id](bad-uuid): uuid: incorrect UUID length: bad-uuid\n") }
explode_data.jsonl/2852
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 525 }
[ 2830, 3393, 24684, 19524, 1155, 353, 8840, 836, 8, 341, 6725, 5909, 1669, 5820, 7121, 4095, 27907, 340, 17060, 1669, 1487, 7121, 12531, 5909, 11, 7342, 220, 15, 340, 67009, 1669, 25798, 7121, 9523, 741, 13158, 2885, 2036, 341, 197, 2958...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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 TestCounterThreadSafe(t *testing.T) { var mutex sync.Mutex counter := 0 for i := 0; i < 5000; i++ { go func() { defer func() { mutex.Unlock() }() mutex.Lock() counter++ }() } time.Sleep(1 * time.Second) t.Logf("counter = %d", counter) }
explode_data.jsonl/34246
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 125 }
[ 2830, 3393, 14099, 6855, 25663, 1155, 353, 8840, 836, 8, 341, 2405, 30863, 12811, 99014, 198, 58261, 1669, 220, 15, 198, 2023, 600, 1669, 220, 15, 26, 600, 366, 220, 20, 15, 15, 15, 26, 600, 1027, 341, 197, 30680, 2915, 368, 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...
1
func TestBucketThrottle(t *testing.T) { t.Parallel() b := NewBucket(50, 50*time.Millisecond) defer b.Close() closec := make(chan struct{}) errc := make(chan error, 1) fill := func() { for { select { case <-closec: return default: if _, err := b.FillThrottle(func(remaining int64) (int64, error) { if remaining < 10 { return remaining, nil } return 10, nil }); err != nil { select { case errc <- err: default: } } } } } for i := 0; i < 5; i++ { go fill() } time.Sleep(time.Second) close(closec) select { case err := <-errc: t.Fatalf("FillThrottle: got %v, want no error", err) default: } }
explode_data.jsonl/74398
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 328 }
[ 2830, 3393, 36018, 1001, 27535, 1155, 353, 8840, 836, 8, 341, 3244, 41288, 7957, 2822, 2233, 1669, 1532, 36018, 7, 20, 15, 11, 220, 20, 15, 77053, 71482, 340, 16867, 293, 10421, 2822, 27873, 66, 1669, 1281, 35190, 2036, 37790, 9859, 6...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
2
func TestVSphereLogin(t *testing.T) { cfg, cleanup := configFromEnvOrSim() defer cleanup() // Create vSphere configuration object vs, err := newControllerNode(cfg) if err != nil { t.Fatalf("Failed to construct/authenticate vSphere: %s", err) } // Create context ctx, cancel := context.WithCancel(context.Background()) defer cancel() // Create vSphere client vcInstance, ok := vs.vsphereInstanceMap[cfg.Global.VCenterIP] if !ok { t.Fatalf("Couldn't get vSphere instance: %s", cfg.Global.VCenterIP) } err = vcInstance.conn.Connect(ctx) if err != nil { t.Errorf("Failed to connect to vSphere: %s", err) } vcInstance.conn.Logout(ctx) }
explode_data.jsonl/65367
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 238 }
[ 2830, 3393, 26050, 8023, 6231, 1155, 353, 8840, 836, 8, 341, 50286, 11, 21290, 1669, 2193, 3830, 14359, 2195, 14027, 741, 16867, 21290, 2822, 197, 322, 4230, 348, 42959, 6546, 1633, 198, 5195, 82, 11, 1848, 1669, 501, 2051, 1955, 28272,...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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 TestRewriteReplaceCustom(t *testing.T) { content := `<img src="http://example.org/logo.svg"><img src="https://example.org/article/picture.svg">` expected := `<img src="http://example.org/logo.svg"><img src="https://example.org/article/picture.png">` output := Rewriter("https://example.org/article", content, `replace("article/(.*).svg"|"article/$1.png")`) if expected != output { t.Errorf(`Not expected output: %s`, output) } }
explode_data.jsonl/21490
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 157 }
[ 2830, 3393, 58465, 1247, 23107, 10268, 1155, 353, 8840, 836, 8, 341, 27751, 1669, 30586, 1892, 2286, 428, 1254, 1110, 8687, 2659, 28547, 15228, 3088, 1892, 2286, 428, 2428, 1110, 8687, 2659, 38181, 4322, 3826, 15228, 755, 3989, 42400, 166...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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 TestSignalFirstLoad(t *testing.T) { t.Run("disabled", func(t *testing.T) { dc := testdataclient.New([]*eskip.Route{{}}) l := loggingtest.New() defer l.Close() rt := routing.New(routing.Options{ FilterRegistry: builtin.MakeRegistry(), DataClients: []routing.DataClient{dc}, PollTimeout: 12 * time.Millisecond, Log: l, }) select { case <-rt.FirstLoad(): default: t.Error("the first load signal was blocking") } if err := l.WaitFor("route settings applied", 12*time.Millisecond); err != nil { t.Error("failed to receive route settings", err) } }) t.Run("enabled", func(t *testing.T) { dc := testdataclient.New([]*eskip.Route{{}}) l := loggingtest.New() defer l.Close() rt := routing.New(routing.Options{ SignalFirstLoad: true, FilterRegistry: builtin.MakeRegistry(), DataClients: []routing.DataClient{dc}, PollTimeout: 12 * time.Millisecond, Log: l, }) select { case <-rt.FirstLoad(): t.Error("the first load signal was not blocking") default: } if err := l.WaitFor("route settings applied", 12*time.Millisecond); err != nil { t.Error("failed to receive route settings", err) } select { case <-rt.FirstLoad(): default: t.Error("the first load signal was blocking") } }) t.Run("enabled, empty", func(t *testing.T) { dc := testdataclient.New(nil) l := loggingtest.New() defer l.Close() rt := routing.New(routing.Options{ SignalFirstLoad: true, FilterRegistry: builtin.MakeRegistry(), DataClients: []routing.DataClient{dc}, PollTimeout: 12 * time.Millisecond, Log: l, }) select { case <-rt.FirstLoad(): t.Error("the first load signal was not blocking") default: } if err := l.WaitFor("route settings applied", 12*time.Millisecond); err != nil { t.Error("failed to receive route settings", err) } select { case <-rt.FirstLoad(): default: t.Error("the first load signal was blocking") } }) t.Run("multiple data clients", func(t *testing.T) { dc1 := testdataclient.New([]*eskip.Route{{}}) dc2 := testdataclient.New([]*eskip.Route{{}}) l := loggingtest.New() defer l.Close() rt := routing.New(routing.Options{ SignalFirstLoad: true, FilterRegistry: builtin.MakeRegistry(), DataClients: []routing.DataClient{dc1, dc2}, PollTimeout: 12 * time.Millisecond, Log: l, }) select { case <-rt.FirstLoad(): t.Error("the first load signal was not blocking") default: } if err := l.WaitForN("route settings applied", 2, 12*time.Millisecond); err != nil { t.Error("failed to receive route settings", err) } select { case <-rt.FirstLoad(): default: t.Error("the first load signal was blocking") } }) }
explode_data.jsonl/58588
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 1156 }
[ 2830, 3393, 26810, 5338, 5879, 1155, 353, 8840, 836, 8, 341, 3244, 16708, 445, 11978, 497, 2915, 1155, 353, 8840, 836, 8, 341, 197, 87249, 1669, 1273, 691, 2972, 7121, 85288, 288, 13389, 58004, 2979, 3417, 692, 197, 8810, 1669, 8392, ...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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 TestPrintPodDisruptionBudgetList(t *testing.T) { minAvailable := intstr.FromInt(22) maxUnavailable := intstr.FromInt(11) pdbList := policy.PodDisruptionBudgetList{ Items: []policy.PodDisruptionBudget{ { ObjectMeta: metav1.ObjectMeta{ Namespace: "ns1", Name: "pdb1", CreationTimestamp: metav1.Time{Time: time.Now().Add(1.9e9)}, }, Spec: policy.PodDisruptionBudgetSpec{ MaxUnavailable: &maxUnavailable, }, Status: policy.PodDisruptionBudgetStatus{ DisruptionsAllowed: 5, }, }, { ObjectMeta: metav1.ObjectMeta{ Namespace: "ns2", Name: "pdb2", CreationTimestamp: metav1.Time{Time: time.Now().Add(1.9e9)}, }, Spec: policy.PodDisruptionBudgetSpec{ MinAvailable: &minAvailable, }, Status: policy.PodDisruptionBudgetStatus{ DisruptionsAllowed: 3, }, }, }, } // Columns: Name, Min Available, Max Available, Allowed Disruptions, Age expectedRows := []metav1.TableRow{ {Cells: []interface{}{"pdb1", "N/A", "11", int64(5), "0s"}}, {Cells: []interface{}{"pdb2", "22", "N/A", int64(3), "0s"}}, } rows, err := printPodDisruptionBudgetList(&pdbList, printers.GenerateOptions{}) if err != nil { t.Fatalf("Error printing pod template list: %#v", err) } for i := range rows { rows[i].Object.Object = nil } if !reflect.DeepEqual(expectedRows, rows) { t.Errorf("mismatch: %s", diff.ObjectReflectDiff(expectedRows, rows)) } }
explode_data.jsonl/21615
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 678 }
[ 2830, 3393, 8994, 23527, 4839, 14123, 62901, 852, 1155, 353, 8840, 836, 8, 341, 25320, 16485, 1669, 526, 495, 11439, 1072, 7, 17, 17, 340, 22543, 92928, 1669, 526, 495, 11439, 1072, 7, 16, 16, 692, 3223, 1999, 852, 1669, 4842, 88823, ...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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 TestEngine_DeleteBucket_Predicate(t *testing.T) { engine := NewDefaultEngine() defer engine.Close() engine.MustOpen() p := func(m, f string, kvs ...string) models.Point { tags := map[string]string{models.FieldKeyTagKey: f, models.MeasurementTagKey: m} for i := 0; i < len(kvs)-1; i += 2 { tags[kvs[i]] = kvs[i+1] } return models.MustNewPoint( tsdb.EncodeNameString(engine.org, engine.bucket), models.NewTags(tags), map[string]interface{}{"value": 1.0}, time.Unix(1, 2), ) } err := engine.Engine.WritePoints(context.TODO(), []models.Point{ p("cpu", "value", "tag1", "val1"), p("cpu", "value", "tag2", "val2"), p("cpu", "value", "tag3", "val3"), p("mem", "value", "tag1", "val1"), p("mem", "value", "tag2", "val2"), p("mem", "value", "tag3", "val3"), }) if err != nil { t.Fatal(err) } // Check the series cardinality. if got, exp := engine.SeriesCardinality(), int64(6); got != exp { t.Fatalf("got %d series, exp %d series in index", got, exp) } // Construct a predicate to remove tag2 pred, err := tsm1.NewProtobufPredicate(&datatypes.Predicate{ Root: &datatypes.Node{ NodeType: datatypes.NodeTypeComparisonExpression, Value: &datatypes.Node_Comparison_{Comparison: datatypes.ComparisonEqual}, Children: []*datatypes.Node{ {NodeType: datatypes.NodeTypeTagRef, Value: &datatypes.Node_TagRefValue{TagRefValue: "tag2"}, }, {NodeType: datatypes.NodeTypeLiteral, Value: &datatypes.Node_StringValue{StringValue: "val2"}, }, }, }, }) if err != nil { t.Fatal(err) } // Remove the matching series. if err := engine.DeleteBucketRangePredicate(context.Background(), engine.org, engine.bucket, math.MinInt64, math.MaxInt64, pred); err != nil { t.Fatal(err) } // Check only matching series were removed. if got, exp := engine.SeriesCardinality(), int64(4); got != exp { t.Fatalf("got %d series, exp %d series in index", got, exp) } // Delete based on field key. pred, err = tsm1.NewProtobufPredicate(&datatypes.Predicate{ Root: &datatypes.Node{ NodeType: datatypes.NodeTypeComparisonExpression, Value: &datatypes.Node_Comparison_{Comparison: datatypes.ComparisonEqual}, Children: []*datatypes.Node{ {NodeType: datatypes.NodeTypeTagRef, Value: &datatypes.Node_TagRefValue{TagRefValue: models.FieldKeyTagKey}, }, {NodeType: datatypes.NodeTypeLiteral, Value: &datatypes.Node_StringValue{StringValue: "value"}, }, }, }, }) if err != nil { t.Fatal(err) } // Remove the matching series. if err := engine.DeleteBucketRangePredicate(context.Background(), engine.org, engine.bucket, math.MinInt64, math.MaxInt64, pred); err != nil { t.Fatal(err) } // Check only matching series were removed. if got, exp := engine.SeriesCardinality(), int64(0); got != exp { t.Fatalf("got %d series, exp %d series in index", got, exp) } }
explode_data.jsonl/5987
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 1171 }
[ 2830, 3393, 4571, 57418, 36018, 1088, 16874, 1155, 353, 8840, 836, 8, 341, 80118, 1669, 1532, 3675, 4571, 741, 16867, 4712, 10421, 741, 80118, 50463, 5002, 2822, 3223, 1669, 2915, 1255, 11, 282, 914, 11, 595, 11562, 2503, 917, 8, 4119, ...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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 TestTracesRequest(t *testing.T) { mr := newTracesRequest(context.Background(), testdata.GenerateTraceDataOneSpan(), nil) traceErr := consumererror.NewTraces(errors.New("some error"), testdata.GenerateTraceDataEmpty()) assert.EqualValues(t, newTracesRequest(context.Background(), testdata.GenerateTraceDataEmpty(), nil), mr.onError(traceErr)) }
explode_data.jsonl/70304
{ "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, 1282, 2434, 1900, 1155, 353, 8840, 836, 8, 341, 2109, 81, 1669, 501, 1282, 2434, 1900, 5378, 19047, 1507, 1273, 691, 57582, 6550, 1043, 3966, 12485, 1507, 2092, 692, 65058, 7747, 1669, 11502, 841, 7121, 1282, 2434, 38881, 71...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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_GetObjectJsonWithStack(t *testing.T) { u := User{4, "name4", 34} json := GetObjectJsonWithStack("", u) t.Log(json) json = GetObjectJsonWithStack("u", u) t.Log(json) }
explode_data.jsonl/67097
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 78 }
[ 2830, 3393, 13614, 1190, 5014, 2354, 4336, 1155, 353, 8840, 836, 8, 341, 10676, 1669, 2657, 90, 19, 11, 330, 606, 19, 497, 220, 18, 19, 532, 30847, 1669, 2126, 1190, 5014, 2354, 4336, 19814, 575, 340, 3244, 5247, 9304, 340, 30847, 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
func TestNewKubeConfig(t *testing.T) { tests := []struct { shouldPanic bool name string expectedPathContains string expectedErrorContains string src kubeconfig.KubeSourceFunc options []kubeconfig.Option }{ { name: "write to temp file", src: kubeconfig.FromByte([]byte(testValidKubeconfig)), options: []kubeconfig.Option{ kubeconfig.InjectFileSystem( testfs.MockFileSystem{ MockTempFile: func(root, pattern string) (fs.File, error) { return testfs.TestFile{ MockName: func() string { return "kubeconfig-142398" }, MockWrite: func() (int, error) { return 0, nil }, MockClose: func() error { return nil }, }, nil }, MockRemoveAll: func() error { return nil }, }, ), }, expectedPathContains: "kubeconfig-142398", }, { name: "cleanup with dump root", expectedPathContains: "kubeconfig-142398", src: kubeconfig.FromByte([]byte(testValidKubeconfig)), options: []kubeconfig.Option{ kubeconfig.InjectTempRoot("/my-unique-root"), kubeconfig.InjectFileSystem( testfs.MockFileSystem{ MockTempFile: func(root, _ string) (fs.File, error) { // check if root path is passed to the TempFile interface if root != "/my-unique-root" { return nil, errTempFile } return testfs.TestFile{ MockName: func() string { return "kubeconfig-142398" }, MockWrite: func() (int, error) { return 0, nil }, MockClose: func() error { return nil }, }, nil }, MockRemoveAll: func() error { return nil }, }, ), }, }, { name: "from file, and fs option", src: kubeconfig.FromFile("/my/kubeconfig", fsWithFile(t, "/my/kubeconfig")), options: []kubeconfig.Option{ kubeconfig.InjectFilePath("/my/kubeconfig", fsWithFile(t, "/my/kubeconfig")), }, expectedPathContains: "/my/kubeconfig", }, { name: "write to real fs", src: kubeconfig.FromAPIalphaV1(testValidKubeconfigAPI), expectedPathContains: "kubeconfig-", }, { name: "from file, use SourceFile", src: kubeconfig.FromFile("/my/kubeconfig", fsWithFile(t, "/my/kubeconfig")), expectedPathContains: "kubeconfig-", }, { name: "temp file error", src: kubeconfig.FromAPIalphaV1(testValidKubeconfigAPI), expectedErrorContains: errTempFile.Error(), options: []kubeconfig.Option{ kubeconfig.InjectFileSystem( testfs.MockFileSystem{ MockTempFile: func(string, string) (fs.File, error) { return nil, errTempFile }, MockRemoveAll: func() error { return nil }, }, ), }, }, { name: "source func error", src: func() ([]byte, error) { return nil, errSourceFunc }, expectedPathContains: "kubeconfig-", expectedErrorContains: errSourceFunc.Error(), }, } for _, tt := range tests { tt := tt t.Run(tt.name, func(t *testing.T) { kubeconf := kubeconfig.NewKubeConfig(tt.src, tt.options...) path, clean, err := kubeconf.GetFile() if tt.expectedErrorContains != "" { require.Error(t, err) assert.Contains(t, err.Error(), tt.expectedErrorContains) } else { require.NoError(t, err) actualPath := path assert.Contains(t, actualPath, tt.expectedPathContains) clean() } }) } }
explode_data.jsonl/31795
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 1734 }
[ 2830, 3393, 3564, 42, 3760, 2648, 1155, 353, 8840, 836, 8, 341, 78216, 1669, 3056, 1235, 341, 197, 197, 5445, 47, 31270, 1843, 1807, 198, 197, 11609, 1698, 914, 198, 197, 42400, 1820, 23805, 220, 914, 198, 197, 42400, 1454, 23805, 914...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
1
func TestMeasurerExperimentNameVersion(t *testing.T) { measurer := tlstool.NewExperimentMeasurer(tlstool.Config{}) if measurer.ExperimentName() != "tlstool" { t.Fatal("unexpected ExperimentName") } if measurer.ExperimentVersion() != "0.1.0" { t.Fatal("unexpected ExperimentVersion") } }
explode_data.jsonl/4136
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 110 }
[ 2830, 3393, 7823, 56294, 77780, 675, 5637, 1155, 353, 8840, 836, 8, 341, 49294, 56294, 1669, 29796, 267, 1749, 7121, 77780, 7823, 56294, 1155, 36687, 1749, 10753, 37790, 743, 6893, 7733, 5121, 14329, 675, 368, 961, 330, 11544, 267, 1749, ...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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 TestUnmarshalFromFile(t *testing.T) { t.Parallel() conf := config{} b := NewConfigReaderBuilder() reader := b.WithFs(afero.NewOsFs()).WithConfigFile("testdata/config.yaml").Build() err := reader.Unmarshal(&conf) require.Nil(t, err) assert.Equal(t, "https://foo.example.com", conf.Gencode.Downstream.Foo.ServiceURL) assert.Equal(t, "https://bar.example.com", conf.Gencode.Downstream.Bar.ServiceURL) }
explode_data.jsonl/53792
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 159 }
[ 2830, 3393, 1806, 27121, 43633, 1155, 353, 8840, 836, 8, 341, 3244, 41288, 7957, 2822, 67850, 1669, 2193, 16094, 2233, 1669, 1532, 2648, 5062, 3297, 741, 61477, 1669, 293, 26124, 48300, 2877, 802, 78, 7121, 28867, 48300, 6011, 2354, 2648,...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
1
func TestEmptyStorageURIPrefixOK(t *testing.T) { g := gomega.NewGomegaWithT(t) isvc := makeTestInferenceService() isvc.Spec.Default.Predictor.Tensorflow.StorageURI = "" g.Expect(isvc.validate(c)).Should(gomega.Succeed()) }
explode_data.jsonl/1480
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 93 }
[ 2830, 3393, 3522, 5793, 1511, 3298, 5060, 3925, 1155, 353, 8840, 836, 8, 341, 3174, 1669, 342, 32696, 7121, 38, 32696, 2354, 51, 1155, 340, 19907, 7362, 1669, 1281, 2271, 641, 2202, 1860, 741, 19907, 7362, 36473, 13275, 1069, 8861, 269,...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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 TestGetCertificate_ForceRSA(t *testing.T) { man := &Manager{ Prompt: AcceptTOS, Cache: newMemCache(t), ForceRSA: true, } defer man.stopRenew() hello := clientHelloInfo(exampleDomain, true) testGetCertificate(t, man, exampleDomain, hello) // ForceRSA was deprecated and is now ignored. cert, err := man.cacheGet(context.Background(), exampleCertKey) if err != nil { t.Fatalf("man.cacheGet: %v", err) } if _, ok := cert.PrivateKey.(*ecdsa.PrivateKey); !ok { t.Errorf("cert.PrivateKey is %T; want *ecdsa.PrivateKey", cert.PrivateKey) } }
explode_data.jsonl/65046
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 219 }
[ 2830, 3393, 1949, 33202, 1400, 16316, 73564, 1155, 353, 8840, 836, 8, 341, 197, 1515, 1669, 609, 2043, 515, 197, 10025, 14749, 25, 256, 20829, 51, 3126, 345, 197, 6258, 1777, 25, 262, 501, 18816, 8233, 1155, 1326, 197, 197, 18573, 735...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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 TestCachedPartitions(t *testing.T) { seedBroker := NewMockBroker(t, 1) replicas := []int32{3, 1, 5} isr := []int32{5, 1} metadataResponse := new(MetadataResponse) metadataResponse.AddBroker("localhost:12345", 2) metadataResponse.AddTopicPartition("my_topic", 0, 2, replicas, isr, []int32{}, ErrNoError) metadataResponse.AddTopicPartition("my_topic", 1, 2, replicas, isr, []int32{}, ErrLeaderNotAvailable) seedBroker.Returns(metadataResponse) config := NewTestConfig() config.Metadata.Retry.Max = 0 c, err := NewClient([]string{seedBroker.Addr()}, config) if err != nil { t.Fatal(err) } client := c.(*client) // Verify they aren't cached the same allP := client.cachedPartitionsResults["my_topic"][allPartitions] writeP := client.cachedPartitionsResults["my_topic"][writablePartitions] if len(allP) == len(writeP) { t.Fatal("Invalid lengths!") } tmp := client.cachedPartitionsResults["my_topic"] // Verify we actually use the cache at all! tmp[allPartitions] = []int32{1, 2, 3, 4} client.cachedPartitionsResults["my_topic"] = tmp if 4 != len(client.cachedPartitions("my_topic", allPartitions)) { t.Fatal("Not using the cache!") } seedBroker.Close() safeClose(t, client) }
explode_data.jsonl/54397
{ "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, 70293, 5800, 5930, 1155, 353, 8840, 836, 8, 341, 197, 22602, 65545, 1669, 1532, 11571, 65545, 1155, 11, 220, 16, 692, 73731, 52210, 1669, 3056, 396, 18, 17, 90, 18, 11, 220, 16, 11, 220, 20, 532, 19907, 81, 1669, 3056, ...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
4
func TestGenerateConfigForTop2Bottom2(t *testing.T) { cfg := Config{ Nickname: "ExampleStrategyTop2Bottom2", Goal: "To demonstrate a complex strategy using exchange level funding and simultaneous processing of data signals", StrategySettings: StrategySettings{ Name: top2bottom2.Name, UseExchangeLevelFunding: true, SimultaneousSignalProcessing: true, ExchangeLevelFunding: []ExchangeLevelFunding{ { ExchangeName: testExchange, Asset: asset.Spot.String(), Currency: currency.BTC.String(), InitialFunds: decimal.NewFromFloat(3), }, { ExchangeName: testExchange, Asset: asset.Spot.String(), Currency: currency.USDT.String(), InitialFunds: decimal.NewFromInt(10000), }, }, CustomSettings: map[string]interface{}{ "mfi-low": 32, "mfi-high": 68, "mfi-period": 14, }, }, CurrencySettings: []CurrencySettings{ { ExchangeName: testExchange, Asset: asset.Spot.String(), Base: currency.BTC.String(), Quote: currency.USDT.String(), BuySide: minMax, SellSide: minMax, Leverage: Leverage{}, MakerFee: makerFee, TakerFee: takerFee, }, { ExchangeName: testExchange, Asset: asset.Spot.String(), Base: currency.DOGE.String(), Quote: currency.USDT.String(), BuySide: minMax, SellSide: minMax, Leverage: Leverage{}, MakerFee: makerFee, TakerFee: takerFee, }, { ExchangeName: testExchange, Asset: asset.Spot.String(), Base: currency.ETH.String(), Quote: currency.BTC.String(), BuySide: minMax, SellSide: minMax, Leverage: Leverage{}, MakerFee: makerFee, TakerFee: takerFee, }, { ExchangeName: testExchange, Asset: asset.Spot.String(), Base: currency.LTC.String(), Quote: currency.BTC.String(), BuySide: minMax, SellSide: minMax, Leverage: Leverage{}, MakerFee: makerFee, TakerFee: takerFee, }, { ExchangeName: testExchange, Asset: asset.Spot.String(), Base: currency.XRP.String(), Quote: currency.USDT.String(), BuySide: minMax, SellSide: minMax, Leverage: Leverage{}, MakerFee: makerFee, TakerFee: takerFee, }, { ExchangeName: testExchange, Asset: asset.Spot.String(), Base: currency.BNB.String(), Quote: currency.BTC.String(), BuySide: minMax, SellSide: minMax, Leverage: Leverage{}, MakerFee: makerFee, TakerFee: takerFee, }, }, DataSettings: DataSettings{ Interval: kline.OneDay.Duration(), DataType: common.CandleStr, APIData: &APIData{ StartDate: startDate, EndDate: endDate, }, }, PortfolioSettings: PortfolioSettings{ BuySide: minMax, SellSide: minMax, Leverage: Leverage{}, }, StatisticSettings: StatisticSettings{ RiskFreeRate: decimal.NewFromFloat(0.03), }, } if saveConfig { result, err := json.MarshalIndent(cfg, "", " ") if err != nil { t.Fatal(err) } p, err := os.Getwd() if err != nil { t.Fatal(err) } err = ioutil.WriteFile(filepath.Join(p, "examples", "t2b2-api-candles-exchange-funding.strat"), result, 0770) if err != nil { t.Error(err) } } }
explode_data.jsonl/58415
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 1768 }
[ 2830, 3393, 31115, 2648, 2461, 5366, 17, 11279, 17, 1155, 353, 8840, 836, 8, 341, 50286, 1669, 5532, 515, 197, 18317, 41052, 25, 330, 13314, 19816, 5366, 17, 11279, 17, 756, 197, 9600, 78, 278, 25, 257, 330, 1249, 19869, 264, 6351, ...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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 TestParseRule(t *testing.T) { // Mostly test we can parse rules with unused features rules := []string{ "||bing.com/fd/ls/$~ping", "||bing.com/fd/ls/$websocket", } for _, rule := range rules { _, err := ParseRule(rule) if err != nil { t.Fatalf("failed to parse rule: %s: %s", rule, err) } } }
explode_data.jsonl/81623
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 132 }
[ 2830, 3393, 14463, 11337, 1155, 353, 8840, 836, 8, 341, 197, 322, 63185, 1273, 582, 646, 4715, 5601, 448, 20006, 4419, 198, 7000, 2425, 1669, 3056, 917, 515, 197, 197, 1, 8484, 7132, 905, 6663, 67, 14, 4730, 10749, 93, 9989, 756, 19...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
3
func TestNamespaceErr(t *testing.T) { env := New() // Tell kube to load config from a file that doesn't exist. The exact error // doesn't matter, this was just the simplest way to force an error to // occur. Users of this package are not able to do this, but the resulting // behavior is the same as if any other error had occurred. kConfigPath := "This doesn't even look like a valid path name" env.config.KubeConfig = &kConfigPath tassert.Equal(t, env.Namespace(), "default") }
explode_data.jsonl/48269
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 144 }
[ 2830, 3393, 22699, 7747, 1155, 353, 8840, 836, 8, 341, 57538, 1669, 1532, 2822, 197, 322, 24647, 80958, 311, 2795, 2193, 504, 264, 1034, 429, 3171, 944, 3000, 13, 576, 4734, 1465, 198, 197, 322, 3171, 944, 4925, 11, 419, 572, 1101, ...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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_CacheMatcher_GetAllResponses_WillReturnErrorIfCacheIsNil(t *testing.T) { RegisterTestingT(t) unit := matching.CacheMatcher{} _, err := unit.GetAllResponses() Expect(err).ToNot(BeNil()) Expect(err.Error()).To(Equal("No cache set")) }
explode_data.jsonl/13679
{ "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, 920, 1777, 37554, 13614, 2403, 70743, 2763, 483, 5598, 1454, 2679, 8233, 3872, 19064, 1155, 353, 8840, 836, 8, 341, 79096, 16451, 51, 1155, 340, 81189, 1669, 12579, 46130, 37554, 31483, 197, 6878, 1848, 1669, 4982, 45732, 7074...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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 TestCancelOrder(t *testing.T) { t.Parallel() _, err := b.CancelOrder(1337) if err == nil { t.Error("Test Failed - CancelOrder() error") } }
explode_data.jsonl/79947
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 62 }
[ 2830, 3393, 9269, 4431, 1155, 353, 8840, 836, 8, 341, 3244, 41288, 7957, 2822, 197, 6878, 1848, 1669, 293, 36491, 4431, 7, 16, 18, 18, 22, 340, 743, 1848, 621, 2092, 341, 197, 3244, 6141, 445, 2271, 21379, 481, 23542, 4431, 368, 146...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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 TestBuildVariableDependencies(t *testing.T) { testSuite := []struct { title string variables map[string]*v1.DashboardVariable result map[string][]string }{ { title: "no variable, not dep", variables: nil, result: map[string][]string{}, }, { title: "constant variable, no dep", variables: map[string]*v1.DashboardVariable{ "myVariable": { Kind: v1.KindConstantVariable, Parameter: &v1.ConstantVariableParameter{ Values: []string{"myConstant"}, }, }, }, result: map[string][]string{}, }, { title: "query variable with no variable used", variables: map[string]*v1.DashboardVariable{ "myVariable": { Kind: v1.KindPromQLQueryVariable, Parameter: &v1.PromQLQueryVariableParameter{ Expr: "vector(1)", }, }, }, result: map[string][]string{}, }, { title: "query variable with variable used", variables: map[string]*v1.DashboardVariable{ "myVariable": { Kind: v1.KindPromQLQueryVariable, Parameter: &v1.PromQLQueryVariableParameter{ Expr: "sum by($doe) (rate($foo{label='$bar'}))", }, }, "foo": { Kind: v1.KindPromQLQueryVariable, Parameter: &v1.PromQLQueryVariableParameter{ Expr: "test", }, }, "bar": { Kind: v1.KindPromQLQueryVariable, Parameter: &v1.PromQLQueryVariableParameter{ Expr: "vector($foo)", }, }, "doe": { Kind: v1.KindConstantVariable, Parameter: &v1.ConstantVariableParameter{ Values: []string{"myConstant"}, }, }, }, result: map[string][]string{ "myVariable": { "doe", "foo", "bar", }, "bar": { "foo", }, }, }, { title: "query variable label_values with variable used", variables: map[string]*v1.DashboardVariable{ "myVariable": { Kind: v1.KindLabelValuesQueryVariable, Parameter: &v1.LabelValuesQueryVariableParameter{ LabelName: "$foo", Matchers: []string{"$foo{$bar='test'}"}, }, }, "foo": { Kind: v1.KindPromQLQueryVariable, Parameter: &v1.PromQLQueryVariableParameter{ Expr: "test", }, }, "bar": { Kind: v1.KindPromQLQueryVariable, Parameter: &v1.PromQLQueryVariableParameter{ Expr: "vector($foo)", }, }, "doe": { Kind: v1.KindConstantVariable, Parameter: &v1.ConstantVariableParameter{ Values: []string{"myConstant"}, }, }, }, result: map[string][]string{ "myVariable": { "foo", "bar", }, "bar": { "foo", }, }, }, { title: "query variable label_names with variable used", variables: map[string]*v1.DashboardVariable{ "myVariable": { Kind: v1.KindLabelNamesQueryVariable, Parameter: &v1.LabelNamesQueryVariableParameter{ Matchers: []string{"$foo{$bar='test'}"}, }, }, "foo": { Kind: v1.KindPromQLQueryVariable, Parameter: &v1.PromQLQueryVariableParameter{ Expr: "test", }, }, "bar": { Kind: v1.KindPromQLQueryVariable, Parameter: &v1.PromQLQueryVariableParameter{ Expr: "vector($foo)", }, }, "doe": { Kind: v1.KindConstantVariable, Parameter: &v1.ConstantVariableParameter{ Values: []string{"myConstant"}, }, }, }, result: map[string][]string{ "myVariable": { "foo", "bar", }, "bar": { "foo", }, }, }, { title: "multiple usage of the same variable", variables: map[string]*v1.DashboardVariable{ "myVariable": { Kind: v1.KindPromQLQueryVariable, Parameter: &v1.PromQLQueryVariableParameter{ Expr: "sum by($doe, $bar) (rate($foo{label='$bar'}))", }, }, "foo": { Kind: v1.KindPromQLQueryVariable, Parameter: &v1.PromQLQueryVariableParameter{ Expr: "test", }, }, "bar": { Kind: v1.KindPromQLQueryVariable, Parameter: &v1.PromQLQueryVariableParameter{ Expr: "vector($foo)", }, }, "doe": { Kind: v1.KindConstantVariable, Parameter: &v1.ConstantVariableParameter{ Values: []string{"myConstant"}, }, }, }, result: map[string][]string{ "myVariable": { "doe", "bar", "foo", }, "bar": { "foo", }, }, }, } for _, test := range testSuite { t.Run(test.title, func(t *testing.T) { result, err := buildVariableDependencies(test.variables) assert.NoError(t, err) assert.Equal(t, len(test.result), len(result)) for k, v := range test.result { assert.ElementsMatch(t, v, result[k]) } }) } }
explode_data.jsonl/34530
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 2202 }
[ 2830, 3393, 11066, 7827, 48303, 1155, 353, 8840, 836, 8, 341, 18185, 28000, 1669, 3056, 1235, 341, 197, 24751, 257, 914, 198, 197, 2405, 2156, 82, 2415, 14032, 8465, 85, 16, 909, 7349, 7827, 198, 197, 9559, 262, 2415, 14032, 45725, 91...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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 TestKeyspaceStringParser(t *testing.T) { tsts := []struct { db string stats string keysTotal, keysEx, avgTTL float64 ok bool }{ {db: "xxx", stats: "", ok: false}, {db: "xxx", stats: "keys=1,expires=0,avg_ttl=0", ok: false}, {db: "db0", stats: "xxx", ok: false}, {db: "db1", stats: "keys=abcd,expires=0,avg_ttl=0", ok: false}, {db: "db2", stats: "keys=1234=1234,expires=0,avg_ttl=0", ok: false}, {db: "db3", stats: "keys=abcde,expires=0", ok: false}, {db: "db3", stats: "keys=213,expires=xxx", ok: false}, {db: "db3", stats: "keys=123,expires=0,avg_ttl=zzz", ok: false}, {db: "db0", stats: "keys=1,expires=0,avg_ttl=0", keysTotal: 1, keysEx: 0, avgTTL: 0, ok: true}, } for _, tst := range tsts { if kt, kx, ttl, ok := parseDBKeyspaceString(tst.db, tst.stats); true { if ok != tst.ok { t.Errorf("failed for: db:%s stats:%s", tst.db, tst.stats) continue } if ok && (kt != tst.keysTotal || kx != tst.keysEx || ttl != tst.avgTTL) { t.Errorf("values not matching, db:%s stats:%s %f %f %f", tst.db, tst.stats, kt, kx, ttl) } } } }
explode_data.jsonl/46984
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 604 }
[ 2830, 3393, 8850, 1306, 703, 6570, 1155, 353, 8840, 836, 8, 341, 3244, 36279, 1669, 3056, 1235, 341, 197, 20939, 664, 914, 198, 197, 79659, 3824, 914, 198, 197, 80112, 7595, 11, 6894, 840, 11, 19712, 51, 13470, 2224, 21, 19, 198, 19...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
8
func TestTranslationKey(t *testing.T) { t.Parallel() assert := require.New(t) cfg, fs := newTestCfg() writeSource(t, fs, filepath.Join("content", filepath.FromSlash("sect/simple.no.md")), "---\ntitle: \"A1\"\ntranslationKey: \"k1\"\n---\nContent\n") writeSource(t, fs, filepath.Join("content", filepath.FromSlash("sect/simple.en.md")), "---\ntitle: \"A2\"\n---\nContent\n") s := buildSingleSite(t, deps.DepsCfg{Fs: fs, Cfg: cfg}, BuildCfg{SkipRender: true}) require.Len(t, s.RegularPages(), 2) home, _ := s.Info.Home() assert.NotNil(home) assert.Equal("home", home.TranslationKey()) assert.Equal("page/k1", s.RegularPages()[0].TranslationKey()) p2 := s.RegularPages()[1] assert.Equal("page/sect/simple", p2.TranslationKey()) }
explode_data.jsonl/60628
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 298 }
[ 2830, 3393, 24412, 1592, 1155, 353, 8840, 836, 8, 341, 3244, 41288, 7957, 741, 6948, 1669, 1373, 7121, 1155, 340, 50286, 11, 8619, 1669, 501, 2271, 42467, 2822, 24945, 3608, 1155, 11, 8619, 11, 26054, 22363, 445, 1796, 497, 26054, 11439...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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 TestEtcdGetPodDifferentNamespace(t *testing.T) { fakeClient := tools.NewFakeEtcdClient(t) ctx1 := api.NewDefaultContext() ctx2 := api.WithNamespace(api.NewContext(), "other") key1, _ := makePodKey(ctx1, "foo") key2, _ := makePodKey(ctx2, "foo") fakeClient.Set(key1, runtime.EncodeOrDie(latest.Codec, &api.Pod{TypeMeta: api.TypeMeta{Namespace: "default", ID: "foo"}}), 0) fakeClient.Set(key2, runtime.EncodeOrDie(latest.Codec, &api.Pod{TypeMeta: api.TypeMeta{Namespace: "other", ID: "foo"}}), 0) registry := NewTestEtcdRegistry(fakeClient) pod1, err := registry.GetPod(ctx1, "foo") if err != nil { t.Errorf("unexpected error: %v", err) } if pod1.ID != "foo" { t.Errorf("Unexpected pod: %#v", pod1) } if pod1.Namespace != "default" { t.Errorf("Unexpected pod: %#v", pod1) } pod2, err := registry.GetPod(ctx2, "foo") if err != nil { t.Errorf("unexpected error: %v", err) } if pod2.ID != "foo" { t.Errorf("Unexpected pod: %#v", pod2) } if pod2.Namespace != "other" { t.Errorf("Unexpected pod: %#v", pod2) } }
explode_data.jsonl/8137
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 445 }
[ 2830, 3393, 31860, 4385, 1949, 23527, 69123, 22699, 1155, 353, 8840, 836, 8, 341, 1166, 726, 2959, 1669, 7375, 7121, 52317, 31860, 4385, 2959, 1155, 692, 20985, 16, 1669, 6330, 7121, 3675, 1972, 741, 20985, 17, 1669, 6330, 26124, 22699, ...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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 TestCheckVersioningIsEnabled(t *testing.T) { tests := []struct { name string input s3.S3 expected bool }{ { name: "S3 bucket versioning disabled", input: s3.S3{ Metadata: types.NewTestMetadata(), Buckets: []s3.Bucket{ { Metadata: types.NewTestMetadata(), Versioning: s3.Versioning{ Metadata: types.NewTestMetadata(), Enabled: types.Bool(false, types.NewTestMetadata()), }, }, }, }, expected: true, }, { name: "S3 bucket versioning enabled", input: s3.S3{ Metadata: types.NewTestMetadata(), Buckets: []s3.Bucket{ { Metadata: types.NewTestMetadata(), Versioning: s3.Versioning{ Metadata: types.NewTestMetadata(), Enabled: types.Bool(true, types.NewTestMetadata()), }, }, }, }, expected: false, }, } for _, test := range tests { t.Run(test.name, func(t *testing.T) { var testState state.State testState.AWS.S3 = test.input results := CheckVersioningIsEnabled.Evaluate(&testState) var found bool for _, result := range results { if result.Status() != rules.StatusPassed && result.Rule().LongID() == CheckVersioningIsEnabled.Rule().LongID() { found = true } } if test.expected { assert.True(t, found, "Rule should have been found") } else { assert.False(t, found, "Rule should not have been found") } }) } }
explode_data.jsonl/25536
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 642 }
[ 2830, 3393, 3973, 5637, 287, 3872, 5462, 1155, 353, 8840, 836, 8, 341, 78216, 1669, 3056, 1235, 341, 197, 11609, 257, 914, 198, 197, 22427, 262, 274, 18, 808, 18, 198, 197, 42400, 1807, 198, 197, 59403, 197, 197, 515, 298, 11609, 25...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
5
func TestQuery(t *testing.T) { // Various basic query test cases following the same pattern cases := []struct { name string input []TestData query string expected []TestData expectedCode int headers map[string]string method string }{ { name: "Basic insert and query with empty query", input: []TestData{{S: "Foo", I: 123, F: 1.5, B: true}}, query: `{}`, expected: []TestData{{S: "Foo", I: 123, F: 1.5, B: true}}}, { name: "Basic project", input: []TestData{{S: "Foo", I: 123, F: 1.5, B: true}}, query: `{"select": ["S"]}`, expected: []TestData{{S: "Foo"}}}, { name: "Projection with unknown column", input: []TestData{{S: "Foo", I: 123, F: 1.5, B: true}}, query: `{"select": ["NONEXISTING"]}`, expectedCode: http.StatusBadRequest}, { name: "Distinct", input: []TestData{{S: "A", I: 1}, {S: "A", I: 2}, {S: "A", I: 2}, {S: "C", I: 1}}, query: `{"distinct": ["S", "I"], "order_by": ["S", "I"]}`, expected: []TestData{{S: "A", I: 1}, {S: "A", I: 2}, {S: "C", I: 1}}}, { name: "Group by without aggregation", input: []TestData{{S: "C", I: 1}, {S: "A", I: 2}, {S: "A", I: 1}, {S: "A", I: 2}, {S: "C", I: 1}}, query: `{"group_by": ["S", "I"], "order_by": ["S", "I"]}`, expected: []TestData{{S: "A", I: 1}, {S: "A", I: 2}, {S: "C", I: 1}}}, { name: "Aggregation with group by", input: []TestData{{S: "A", I: 2}, {S: "C", I: 1}, {S: "A", I: 1}, {S: "A", I: 2}}, query: `{"select": ["S", ["sum", "I"]], "group_by": ["S"], "order_by": ["S"]}`, expected: []TestData{{S: "A", I: 5}, {S: "C", I: 1}}}, { name: "Aggregation without group by", input: []TestData{{S: "A", I: 2}, {S: "C", I: 1}, {S: "A", I: 1}, {S: "A", I: 2}}, query: `{"select": [["sum", "I"]]}`, expected: []TestData{{I: 6}}}, { name: "Simple column alias", input: []TestData{{I: 1}, {I: 2}}, query: `{"select": ["I", ["=", "I2", "I"]]}`, expected: []TestData{{I: 1, I2: 1}, {I: 2, I2: 2}}}, { name: "Simple constant alias", input: []TestData{{I: 1}, {I: 2}}, query: `{"select": ["I", ["=", "I2", 22]]}`, expected: []TestData{{I: 1, I2: 22}, {I: 2, I2: 22}}}, { name: "alias with operation", input: []TestData{{I: 1, I2: 10}, {I: 2, I2: 20}}, query: `{"select": ["I", ["=", "I3", ["+", "I2", "I"]]]}`, expected: []TestData{{I: 1, I3: 11}, {I: 2, I3: 22}}}, { name: "Sub query", input: []TestData{{I: 1}, {I: 2}, {I: 3}}, query: `{"where": [">", "I", 1], "from": {"where": ["<", "I", 3]}}`, expected: []TestData{{I: 2}}, }, { name: "Sub query in POST", input: []TestData{{I: 1}, {I: 2}, {I: 3}}, query: `{"where": [">", "I", 1], "from": {"where": ["<", "I", 3]}}`, expected: []TestData{{I: 2}}, method: "POST", }, { name: "Unicode GET", input: []TestData{{S: "ÅÄÖ"}, {S: "«ταБЬℓσ»"}, {S: "ABC"}}, query: `{"where": ["=", "S", "'«ταБЬℓσ»'"]}`, expected: []TestData{{S: "«ταБЬℓσ»"}}, method: "GET", }, { name: "Unicode POST", input: []TestData{{S: "ÅÄÖ"}, {S: "«ταБЬℓσ»"}, {S: "ABC"}}, query: `{"where": ["=", "S", "'«ταБЬℓσ»'"]}`, expected: []TestData{{S: "«ταБЬℓσ»"}}, method: "POST", }, // TODO: Test "in" with subexpression } for _, tc := range cases { t.Run(tc.name, func(t *testing.T) { cache := newTestCache(t) cache.insertJson("FOO", tc.headers, tc.input) output := make([]TestData, 0) if tc.method == "" { tc.method = "GET" } rr := cache.queryJson("FOO", map[string]string{}, tc.query, tc.method, &output) // Assume OK if code left out from test definition if tc.expectedCode == 0 { tc.expectedCode = http.StatusOK } if rr.Code != tc.expectedCode { t.Errorf("Unexpected status code: %v, %s", rr.Code, rr.Body.String()) } if tc.expectedCode == http.StatusOK { compareTestData(t, output, tc.expected) } }) } }
explode_data.jsonl/8991
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 2087 }
[ 2830, 3393, 2859, 1155, 353, 8840, 836, 8, 341, 197, 322, 39641, 6770, 3239, 1273, 5048, 2701, 279, 1852, 5383, 198, 1444, 2264, 1669, 3056, 1235, 341, 197, 11609, 260, 914, 198, 197, 22427, 286, 3056, 83920, 198, 197, 27274, 286, 914...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
5
func TestAccKeycloakOpenidClient_redirectUrisValidation(t *testing.T) { realmName := "terraform-" + acctest.RandString(10) clientId := "terraform-" + acctest.RandString(10) accessType := randomStringInSlice([]string{"PUBLIC", "CONFIDENTIAL"}) resource.Test(t, resource.TestCase{ ProviderFactories: testAccProviderFactories, PreCheck: func() { testAccPreCheck(t) }, CheckDestroy: testAccCheckKeycloakOpenidClientDestroy(), Steps: []resource.TestStep{ { Config: testKeycloakOpenidClient_invalidRedirectUris(realmName, clientId, accessType, true, false), ExpectError: regexp.MustCompile("validation error: standard \\(authorization code\\) and implicit flows require at least one valid redirect uri"), }, { Config: testKeycloakOpenidClient_invalidRedirectUris(realmName, clientId, accessType, false, true), ExpectError: regexp.MustCompile("validation error: standard \\(authorization code\\) and implicit flows require at least one valid redirect uri"), }, }, }) }
explode_data.jsonl/52135
{ "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, 14603, 1592, 88751, 5002, 307, 2959, 30043, 52, 5963, 13799, 1155, 353, 8840, 836, 8, 341, 17200, 7673, 675, 1669, 330, 61385, 27651, 488, 1613, 67880, 2013, 437, 703, 7, 16, 15, 340, 25291, 764, 1669, 330, 61385, 27651, 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 TestBuildPreserveOwnership(t *testing.T) { skip.If(t, testEnv.DaemonInfo.OSType == "windows", "FIXME") skip.If(t, versions.LessThan(testEnv.DaemonAPIVersion(), "1.40"), "broken in earlier versions") ctx := context.Background() dockerfile, err := ioutil.ReadFile("testdata/Dockerfile.testBuildPreserveOwnership") assert.NilError(t, err) source := fakecontext.New(t, "", fakecontext.WithDockerfile(string(dockerfile))) defer source.Close() apiclient := testEnv.APIClient() for _, target := range []string{"copy_from", "copy_from_chowned"} { t.Run(target, func(t *testing.T) { resp, err := apiclient.ImageBuild( ctx, source.AsTarReader(t), types.ImageBuildOptions{ Remove: true, ForceRemove: true, Target: target, }, ) assert.NilError(t, err) out := bytes.NewBuffer(nil) _, err = io.Copy(out, resp.Body) _ = resp.Body.Close() if err != nil { t.Log(out) } assert.NilError(t, err) }) } }
explode_data.jsonl/82589
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 420 }
[ 2830, 3393, 11066, 14367, 5852, 77166, 1155, 353, 8840, 836, 8, 341, 1903, 13389, 32901, 1155, 11, 1273, 14359, 909, 64, 7291, 1731, 13, 4233, 499, 621, 330, 27077, 497, 330, 81019, 1138, 1903, 13389, 32901, 1155, 11, 10795, 1214, 433, ...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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