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 TestPackageEquals(t *testing.T) { pkg1 := &Package{Path: RefTerm(VarTerm("foo"), StringTerm("bar"), StringTerm("baz")).Value.(Ref)} pkg2 := &Package{Path: RefTerm(VarTerm("foo"), StringTerm("bar"), StringTerm("baz")).Value.(Ref)} pkg3 := &Package{Path: RefTerm(VarTerm("foo"), StringTerm("qux"), StringTerm("baz")).Value.(Ref)} assertPackagesEqual(t, pkg1, pkg1) assertPackagesEqual(t, pkg1, pkg2) assertPackagesNotEqual(t, pkg1, pkg3) assertPackagesNotEqual(t, pkg2, pkg3) }
explode_data.jsonl/65298
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 192 }
[ 2830, 3393, 13100, 4315, 1155, 353, 8840, 836, 8, 341, 3223, 7351, 16, 1669, 609, 13100, 90, 1820, 25, 8550, 17249, 7, 3962, 17249, 445, 7975, 3975, 923, 17249, 445, 2257, 3975, 923, 17249, 445, 42573, 15197, 1130, 12832, 3945, 10569, ...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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 TestGetPodPhaseMap(t *testing.T) { // empty pod list should result in empty pod phase map pods := &v1.PodList{Items: []v1.Pod{}} podPhaseMap := GetPodPhaseMap(pods) assert.Equal(t, 0, len(podPhaseMap)) // 2 running pods, 1 failed pod pods = &v1.PodList{ Items: []v1.Pod{ {ObjectMeta: metav1.ObjectMeta{Name: "pod1"}, Status: v1.PodStatus{Phase: v1.PodRunning}}, {ObjectMeta: metav1.ObjectMeta{Name: "pod2"}, Status: v1.PodStatus{Phase: v1.PodRunning}}, {ObjectMeta: metav1.ObjectMeta{Name: "pod3"}, Status: v1.PodStatus{Phase: v1.PodFailed}}, }, } podPhaseMap = GetPodPhaseMap(pods) // map should have 2 entries, 1 list of running pods and 1 list of failed pods assert.Equal(t, 2, len(podPhaseMap)) // list of running pods should have 2 entries assert.Equal(t, 2, len(podPhaseMap[v1.PodRunning])) // list of failed pods should have 1 entry assert.Equal(t, 1, len(podPhaseMap[v1.PodFailed])) }
explode_data.jsonl/9465
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 358 }
[ 2830, 3393, 1949, 23527, 30733, 2227, 1155, 353, 8840, 836, 8, 341, 197, 322, 4287, 7509, 1140, 1265, 1102, 304, 4287, 7509, 10262, 2415, 198, 3223, 29697, 1669, 609, 85, 16, 88823, 852, 90, 4353, 25, 3056, 85, 16, 88823, 6257, 532, ...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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 TestManifestGenErrorCacheRespectsNoCache(t *testing.T) { service := newService(".") service.initConstants = RepoServerInitConstants{ ParallelismLimit: 1, PauseGenerationAfterFailedGenerationAttempts: 1, PauseGenerationOnFailureForMinutes: 0, PauseGenerationOnFailureForRequests: 4, } // 1) Put the cache into the failure state for x := 0; x < 2; x++ { res, err := service.GenerateManifest(context.Background(), &apiclient.ManifestRequest{ Repo: &argoappv1.Repository{}, AppName: "test", ApplicationSource: &argoappv1.ApplicationSource{ Path: "./testdata/invalid-helm", }, }) assert.True(t, err != nil && res == nil) // Ensure that the second invocation is cached if x == 1 { assert.True(t, strings.HasPrefix(err.Error(), cachedManifestGenerationPrefix)) } } // 2) Call generateManifest with NoCache enabled res, err := service.GenerateManifest(context.Background(), &apiclient.ManifestRequest{ Repo: &argoappv1.Repository{}, AppName: "test", ApplicationSource: &argoappv1.ApplicationSource{ Path: "./testdata/invalid-helm", }, NoCache: true, }) // 3) Ensure that the cache returns a new generation attempt, rather than a previous cached error assert.True(t, err != nil && res == nil) assert.True(t, !strings.HasPrefix(err.Error(), cachedManifestGenerationPrefix)) // 4) Call generateManifest res, err = service.GenerateManifest(context.Background(), &apiclient.ManifestRequest{ Repo: &argoappv1.Repository{}, AppName: "test", ApplicationSource: &argoappv1.ApplicationSource{ Path: "./testdata/invalid-helm", }, }) // 5) Ensure that the subsequent invocation, after nocache, is cached assert.True(t, err != nil && res == nil) assert.True(t, strings.HasPrefix(err.Error(), cachedManifestGenerationPrefix)) }
explode_data.jsonl/5673
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 657 }
[ 2830, 3393, 38495, 9967, 1454, 8233, 1061, 7973, 2753, 8233, 1155, 353, 8840, 836, 8, 1476, 52934, 1669, 501, 1860, 445, 31225, 52934, 8271, 9386, 284, 71509, 5475, 3803, 9386, 515, 197, 197, 16547, 2142, 16527, 25, 220, 16, 345, 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...
6
func TestPutReflect_struct_invalid(t *testing.T) { var tests = []interface{}{ invalidStruct{}, struct{}{}, time.Time{}, } b := make([]byte, 16) for _, tt := range tests { err := lex.PutReflect(b, tt) assert.NotNil(t, err) } }
explode_data.jsonl/50148
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 109 }
[ 2830, 3393, 19103, 72789, 15126, 31433, 1155, 353, 8840, 836, 8, 341, 2405, 7032, 284, 3056, 4970, 67066, 197, 197, 11808, 9422, 38837, 197, 6472, 6257, 38837, 197, 21957, 16299, 38837, 197, 532, 2233, 1669, 1281, 10556, 3782, 11, 220, ...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
2
func TestHookExecutor_executeExecNewCreatePodFailure(t *testing.T) { hook := &deployapi.LifecycleHook{ FailurePolicy: deployapi.LifecycleHookFailurePolicyAbort, ExecNewPod: &deployapi.ExecNewPodHook{ ContainerName: "container1", }, } dc := deploytest.OkDeploymentConfig(1) deployment, _ := deployutil.MakeDeployment(dc, kapi.Codecs.LegacyCodec(deployv1.SchemeGroupVersion)) client := newTestClient(dc) client.AddReactor("create", "pods", func(a testclient.Action) (handled bool, ret runtime.Object, err error) { return true, nil, errors.New("could not create the pod") }) executor := &HookExecutor{ pods: client, decoder: kapi.Codecs.UniversalDecoder(), } if err := executor.executeExecNewPod(hook, deployment, "hook", "test"); err == nil { t.Fatalf("expected an error") } }
explode_data.jsonl/6333
{ "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, 31679, 25255, 44329, 10216, 3564, 4021, 23527, 17507, 1155, 353, 8840, 836, 8, 341, 9598, 1941, 1669, 609, 35794, 2068, 1214, 19517, 31679, 515, 197, 12727, 9373, 13825, 25, 10517, 2068, 1214, 19517, 31679, 17507, 13825, 85891, ...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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 TestPublishedIndex(t *testing.T) { tests := []struct { Name string PublishedName string Error error EmptyIndex bool }{ { Name: "empty", Error: rerror.ErrNotFound, }, { Name: "empty index", Error: rerror.ErrNotFound, EmptyIndex: true, }, { Name: "not found", PublishedName: "pr", Error: rerror.ErrNotFound, }, { Name: "ok", PublishedName: "prj", }, } for _, tc := range tests { tc := tc t.Run(tc.Name, func(t *testing.T) { t.Parallel() assert := assert.New(t) req := httptest.NewRequest(http.MethodGet, "/aaa/bbb", nil) res := httptest.NewRecorder() e := echo.New() c := e.NewContext(req, res) c.SetParamNames("name") c.SetParamValues(tc.PublishedName) m := mockPublishedUsecaseMiddleware(tc.EmptyIndex) err := m(PublishedIndex())(c) if tc.Error == nil { assert.NoError(err) assert.Equal(http.StatusOK, res.Code) assert.Equal("text/html; charset=UTF-8", res.Header().Get(echo.HeaderContentType)) assert.Equal("index", res.Body.String()) } else { assert.ErrorIs(err, tc.Error) } }) } }
explode_data.jsonl/36779
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 562 }
[ 2830, 3393, 28886, 1552, 1155, 353, 8840, 836, 8, 341, 78216, 1669, 3056, 1235, 341, 197, 21297, 688, 914, 198, 197, 10025, 11669, 675, 914, 198, 197, 58421, 260, 1465, 198, 197, 197, 3522, 1552, 262, 1807, 198, 197, 59403, 197, 197, ...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
2
func TestScratchSite(t *testing.T) { t.Parallel() b := newTestSitesBuilder(t) b.WithSimpleConfigFile().WithTemplatesAdded("index.html", ` {{ .Scratch.Set "b" "bv" }} B: {{ .Scratch.Get "b" }} `, "shortcodes/scratch.html", ` {{ .Scratch.Set "c" "cv" }} C: {{ .Scratch.Get "c" }} `, ) b.WithContentAdded("scratchme.md", ` --- title: Scratch Me! --- {{< scratch >}} `) b.Build(BuildCfg{}) b.AssertFileContent("public/index.html", "B: bv") b.AssertFileContent("public/scratchme/index.html", "C: cv") }
explode_data.jsonl/60639
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 221 }
[ 2830, 3393, 65508, 754, 17597, 1155, 353, 8840, 836, 8, 341, 3244, 41288, 7957, 2822, 2233, 1669, 501, 2271, 93690, 3297, 1155, 340, 2233, 26124, 16374, 2648, 1703, 1005, 2354, 51195, 19337, 445, 1252, 2564, 497, 22074, 2979, 659, 65508, ...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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_search_dict(t *testing.T) { msg := ` {"key": "hello world"} ^^^^^ ^^^^^^^^^^^^^ ` d := NewDict() d.Set("key", "hello world") m := &model{ json: d, } re, _ := regexp.Compile("\"[\\w\\s]+\"") indexes := re.FindAllStringIndex(Stringify(m.json), -1) m.remapSearchResult(m.json, "", 0, indexes, 0, nil) s1 := &searchResult{path: ".key"} s1.ranges = append(s1.ranges, &foundRange{ parent: s1, path: ".key", start: 0, end: 5, kind: keyRange, }, ) s2 := &searchResult{path: ".key", index: 1} s2.ranges = append(s2.ranges, &foundRange{ parent: s2, path: ".key", start: 0, end: 13, kind: valueRange, }, ) require.Equal(t, []*searchResult{s1, s2}, m.searchResults, msg) }
explode_data.jsonl/33479
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 365 }
[ 2830, 3393, 10716, 5243, 1155, 353, 8840, 836, 8, 341, 21169, 1669, 22074, 197, 4913, 792, 788, 330, 14990, 1879, 16707, 197, 6306, 61724, 220, 6306, 61724, 61724, 61724, 198, 3989, 2698, 1669, 1532, 13448, 741, 2698, 4202, 445, 792, 49...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
1
func TestFastCriticalRestarts(t *testing.T) { testCases := []struct { protocol int progress bool }{ {63, false}, {64, false}, {63, true}, {64, true}, } for _, tc := range testCases { t.Run(fmt.Sprintf("protocol %d progress %v", tc.protocol, tc.progress), func(t *testing.T) { testFastCriticalRestarts(t, tc.protocol, tc.progress) }) } }
explode_data.jsonl/33429
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 153 }
[ 2830, 3393, 32174, 42008, 12416, 7038, 1155, 353, 8840, 836, 8, 341, 18185, 37302, 1669, 3056, 1235, 341, 197, 197, 17014, 526, 198, 197, 88971, 1807, 198, 197, 59403, 197, 197, 90, 21, 18, 11, 895, 1583, 197, 197, 90, 21, 19, 11, ...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
1
func Test_SetHttpClientTLSCodec(t *testing.T) { l, _ := Listen(":") l.AddCodecFactory(func(ctx Context) Codec { cc := NewTLSServerCodec() cc.AddCertificate(testCert, testKEY) return cc }) var isTLS interface{} go func() { http.Serve(l, http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) { h, _ := w.(http.Hijacker) c, _, _ := h.Hijack() isTLS = c.(*Conn).Ctx().IsTLS() c.Write([]byte("HTTP/1.0 200 OK \r\n\r\nhello")) c.Close() })) }() client := &http.Client{} NewTLSClientCodec().AddServerCa(testCert).AddToHTTPClient(client) resp, _ := client.Get("https://" + NewAddr(l.Addr()).PortLocalAddr()) b, _ := ioutil.ReadAll(resp.Body) assert.Equal(t, "hello", string(b)) assert.Equal(t, true, isTLS) }
explode_data.jsonl/34699
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 334 }
[ 2830, 3393, 14812, 26316, 45439, 36913, 1155, 353, 8840, 836, 8, 341, 8810, 11, 716, 1669, 32149, 18893, 1138, 8810, 1904, 36913, 4153, 18552, 7502, 9608, 8, 67077, 341, 197, 63517, 1669, 1532, 13470, 1220, 2836, 36913, 741, 197, 63517, ...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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 TestLastExecuteDDLFlag(t *testing.T) { store, clean := realtikvtest.CreateMockStoreAndSetup(t) defer clean() tk := testkit.NewTestKit(t, store) tk.MustExec("use test") tk.MustExec("drop table if exists t1") tk.MustExec("create table t1(id int)") require.NotNil(t, tk.Session().Value(sessionctx.LastExecuteDDL)) tk.MustExec("insert into t1 values (1)") require.Nil(t, tk.Session().Value(sessionctx.LastExecuteDDL)) }
explode_data.jsonl/5784
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 167 }
[ 2830, 3393, 5842, 17174, 58781, 12135, 1155, 353, 8840, 836, 8, 341, 57279, 11, 4240, 1669, 1931, 83, 1579, 85, 1944, 7251, 11571, 6093, 3036, 21821, 1155, 340, 16867, 4240, 2822, 3244, 74, 1669, 1273, 8226, 7121, 2271, 7695, 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...
1
func TestIsArrayIsObject(t *testing.T) { mtok := get(basicJSON, "loggy") assert(t, mtok.IsObject()) assert(t, !mtok.IsArray()) mtok = get(basicJSON, "loggy.programmers") assert(t, !mtok.IsObject()) assert(t, mtok.IsArray()) mtok = get(basicJSON, `loggy.programmers.#[tag="good"]#.firstName`) assert(t, mtok.IsArray()) mtok = get(basicJSON, `loggy.programmers.0.firstName`) assert(t, !mtok.IsObject()) assert(t, !mtok.IsArray()) }
explode_data.jsonl/43422
{ "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, 3872, 1857, 3872, 1190, 1155, 353, 8840, 836, 8, 341, 2109, 29594, 1669, 633, 1883, 5971, 5370, 11, 330, 839, 4577, 1138, 6948, 1155, 11, 11965, 562, 4506, 1190, 2398, 6948, 1155, 11, 753, 2501, 562, 4506, 1857, 12367, 210...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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 TestChannelArbitratorCooperativeClose(t *testing.T) { log := &mockArbitratorLog{ state: StateDefault, newStates: make(chan ArbitratorState, 5), } chanArbCtx, err := createTestChannelArbitrator(t, log) if err != nil { t.Fatalf("unable to create ChannelArbitrator: %v", err) } if err := chanArbCtx.chanArb.Start(); err != nil { t.Fatalf("unable to start ChannelArbitrator: %v", err) } defer func() { if err := chanArbCtx.chanArb.Stop(); err != nil { t.Fatalf("unable to stop chan arb: %v", err) } }() // It should start out in the default state. chanArbCtx.AssertState(StateDefault) // We set up a channel to detect when MarkChannelClosed is called. closeInfos := make(chan *channeldb.ChannelCloseSummary) chanArbCtx.chanArb.cfg.MarkChannelClosed = func( closeInfo *channeldb.ChannelCloseSummary, statuses ...channeldb.ChannelStatus) error { closeInfos <- closeInfo return nil } // Cooperative close should do trigger a MarkChannelClosed + // MarkChannelResolved. closeInfo := &CooperativeCloseInfo{ &channeldb.ChannelCloseSummary{}, } chanArbCtx.chanArb.cfg.ChainEvents.CooperativeClosure <- closeInfo select { case c := <-closeInfos: if c.CloseType != channeldb.CooperativeClose { t.Fatalf("expected cooperative close, got %v", c.CloseType) } case <-time.After(defaultTimeout): t.Fatalf("timeout waiting for channel close") } // It should mark the channel as resolved. select { case <-chanArbCtx.resolvedChan: // Expected. case <-time.After(defaultTimeout): t.Fatalf("contract was not resolved") } }
explode_data.jsonl/3690
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 577 }
[ 2830, 3393, 9629, 6953, 4489, 81, 850, 7339, 42619, 7925, 1155, 353, 8840, 836, 8, 341, 6725, 1669, 609, 16712, 6953, 4489, 81, 850, 2201, 515, 197, 24291, 25, 257, 3234, 3675, 345, 197, 8638, 23256, 25, 1281, 35190, 58795, 81, 850, ...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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 TestFromStringEmpty(t *testing.T) { if id, err := FromString(""); err != nil || id != 0 { t.Fatalf("Must return 0 on empty string, but was: %v %v", err, id) } }
explode_data.jsonl/18724
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 64 }
[ 2830, 3393, 44491, 3522, 1155, 353, 8840, 836, 8, 341, 743, 877, 11, 1848, 1669, 5542, 703, 97918, 1848, 961, 2092, 1369, 877, 961, 220, 15, 341, 197, 3244, 30762, 445, 31776, 470, 220, 15, 389, 4287, 914, 11, 714, 572, 25, 1018, ...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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 TestPrepareErrorOptionalDownloadAndInstall(t *testing.T) { rh := newFakeSTI(&FakeSTI{}) rh.SetScripts([]string{api.Assemble, api.Run}, []string{api.SaveArtifacts}) err := rh.Prepare(rh.config) if err != nil { t.Errorf("Unexpected error when downloading optional scripts: %v", err) } }
explode_data.jsonl/59449
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 106 }
[ 2830, 3393, 50590, 1454, 15309, 11377, 3036, 24690, 1155, 353, 8840, 836, 8, 341, 7000, 71, 1669, 501, 52317, 784, 40, 2099, 52317, 784, 40, 37790, 7000, 71, 4202, 44942, 10556, 917, 90, 2068, 20242, 15790, 11, 6330, 16708, 2137, 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...
2
func TestOrgSummary(t *testing.T) { Convey("Get org summary", t, func() { setup(MockRoute{"GET", "/v2/organizations/06dcedd4-1f24-49a6-adc1-cce9131a1b2c/summary", []string{orgSummaryPayload}, "", 200, "", nil}, t) defer teardown() c := &Config{ ApiAddress: server.URL, Token: "foobar", } client, err := NewClient(c) So(err, ShouldBeNil) org := &Org{ Guid: "06dcedd4-1f24-49a6-adc1-cce9131a1b2c", c: client, } summary, err := org.Summary() So(err, ShouldBeNil) So(summary.Guid, ShouldEqual, "06dcedd4-1f24-49a6-adc1-cce9131a1b2c") So(summary.Name, ShouldEqual, "system") So(summary.Status, ShouldEqual, "active") spaces := summary.Spaces So(len(spaces), ShouldEqual, 1) So(spaces[0].Guid, ShouldEqual, "494d8b64-8181-4183-a6d3-6279db8fec6e") So(spaces[0].Name, ShouldEqual, "test") So(spaces[0].ServiceCount, ShouldEqual, 1) So(spaces[0].AppCount, ShouldEqual, 2) So(spaces[0].MemDevTotal, ShouldEqual, 32) So(spaces[0].MemProdTotal, ShouldEqual, 64) }) }
explode_data.jsonl/4434
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 494 }
[ 2830, 3393, 42437, 19237, 1155, 353, 8840, 836, 8, 341, 93070, 5617, 445, 1949, 1240, 12126, 497, 259, 11, 2915, 368, 341, 197, 84571, 66436, 4899, 4913, 3806, 497, 3521, 85, 17, 14, 69253, 14, 15, 21, 67, 1998, 67, 19, 12, 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...
1
func TestIAVLNoPrune(t *testing.T) { db := dbm.NewMemDB() tree := iavl.NewVersionedTree(db, cacheSize) iavlStore := newIAVLStore(tree, numRecent, int64(1)) nextVersion(iavlStore) for i := 1; i < 100; i++ { for j := 1; j <= i; j++ { require.True(t, iavlStore.VersionExists(int64(j)), "Missing version %d with latest version %d. Should be storing all versions", j, i) } nextVersion(iavlStore) } }
explode_data.jsonl/44277
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 177 }
[ 2830, 3393, 5863, 30698, 2753, 3533, 2886, 1155, 353, 8840, 836, 8, 341, 20939, 1669, 2927, 76, 7121, 18816, 3506, 741, 51968, 1669, 600, 67311, 7121, 5637, 291, 6533, 9791, 11, 6500, 1695, 340, 8230, 67311, 6093, 1669, 501, 5863, 30698...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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 TestChatSrvRetentionSweepConv(t *testing.T) { sweepChannel := randSweepChannel() t.Logf("sweepChannel: %v", sweepChannel) runWithMemberTypes(t, func(mt chat1.ConversationMembersType) { switch mt { case chat1.ConversationMembersType_KBFS: t.Logf("skipping kbfs stage") return default: // Fall through for other member types. } runWithRetentionPolicyTypes(t, func(policy chat1.RetentionPolicy, ephemeralLifetime *gregor1.DurationSec) { ctc := makeChatTestContext(t, "TestChatSrvRetention", 2) defer ctc.cleanup() users := ctc.users() ctx := ctc.as(t, users[0]).startCtx listener := newServerChatListener() ctc.as(t, users[1]).h.G().NotifyRouter.AddListener(listener) conv := mustCreateConversationForTest(t, ctc, users[0], chat1.TopicType_CHAT, mt, ctc.as(t, users[1]).user()) mustPostLocalForTest(t, ctc, users[0], conv, chat1.NewMessageBodyWithText(chat1.MessageText{Body: "hello!"})) consumeNewMsgRemote(t, listener, chat1.MessageType_TEXT) mustPostLocalForTest(t, ctc, users[1], conv, chat1.NewMessageBodyWithText(chat1.MessageText{Body: "hello!"})) consumeNewMsgRemote(t, listener, chat1.MessageType_TEXT) mustSetConvRetention(t, ctc, users[0], conv.Id, policy, sweepChannel) require.True(t, consumeSetConvRetention(t, listener).Eq(conv.Id)) // This will take at least 1 second. For the deletable message to get old enough. expungeInfo := sweepPollForDeletion(t, ctc, users[1], listener, conv.Id, 4) require.True(t, expungeInfo.ConvID.Eq(conv.Id)) require.Equal(t, chat1.Expunge{Upto: 4}, expungeInfo.Expunge, "expunge upto") tvres, err := ctc.as(t, users[1]).chatLocalHandler().GetThreadLocal(ctx, chat1.GetThreadLocalArg{ConversationID: conv.Id}) require.NoError(t, err) require.Len(t, tvres.Thread.Messages, 1, "the TEXTs should be deleted") // If we are using an ephemeral policy make sure messages with a lifetime exceeding // the policy age are blocked. if ephemeralLifetime != nil { badLifetime := *ephemeralLifetime + 1 _, err := postLocalEphemeralForTest(t, ctc, users[0], conv, chat1.NewMessageBodyWithText(chat1.MessageText{Body: "hello!"}), &badLifetime) require.Error(t, err) require.IsType(t, libkb.ChatEphemeralRetentionPolicyViolatedError{}, err) mustPostLocalEphemeralForTest(t, ctc, users[0], conv, chat1.NewMessageBodyWithText(chat1.MessageText{Body: "hello!"}), ephemeralLifetime) } }) }) }
explode_data.jsonl/63706
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 965 }
[ 2830, 3393, 15672, 50, 10553, 86329, 50, 48542, 34892, 1155, 353, 8840, 836, 8, 341, 1903, 48542, 9629, 1669, 10382, 50, 48542, 9629, 741, 3244, 98954, 445, 82, 48542, 9629, 25, 1018, 85, 497, 23146, 9629, 340, 56742, 2354, 9366, 4173, ...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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 TestMethod(t *testing.T) { gopClTest(t, ` type M int func (m M) Foo() { println("foo", m) } func (M) Bar() { println("bar") } `, `package main import fmt "fmt" type M int func (m M) Foo() { fmt.Println("foo", m) } func (M) Bar() { fmt.Println("bar") } `) }
explode_data.jsonl/73664
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 129 }
[ 2830, 3393, 3523, 1155, 353, 8840, 836, 8, 341, 3174, 453, 5066, 2271, 1155, 11, 22074, 1313, 386, 526, 271, 2830, 320, 76, 386, 8, 33428, 368, 341, 81168, 445, 7975, 497, 296, 340, 630, 2830, 320, 44, 8, 4716, 368, 341, 81168, 44...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
1
func TestUpdateRecordAtID(t *testing.T) { setupDataFileForTest() var result = false updateById("notes", "1", []byte(`{"title" : "blah blah blah"}`)) // see if it persisted records, _ := getData() children, _ := records.S("notes").Children() // find the index of the record we have to delete for _, child := range children { // if we find it.... if child.S("id").Data().(float64) == 1 && child.S("title").Data().(string) == "blah blah blah" { // save the record we found as the result along with the index result = true break } } if !result { t.Errorf("New record wasn't found in the json - failed") } }
explode_data.jsonl/81921
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 221 }
[ 2830, 3393, 4289, 6471, 1655, 915, 1155, 353, 8840, 836, 8, 1476, 84571, 1043, 1703, 2461, 2271, 2822, 2405, 1102, 284, 895, 271, 27175, 2720, 445, 18286, 497, 330, 16, 497, 3056, 3782, 5809, 4913, 2102, 1, 549, 330, 70614, 52561, 525...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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 TestEditBoard(t *testing.T) { board := testData.BoardWithCities req := httptest.NewRequest("GET", fmt.Sprintf("/boards/%d/edit", board.ID), nil) w := httptest.NewRecorder() router.ServeHTTP(w, req) //t.Log("Body:", w.Body.String()) httpassert.Success(t, w) httpassert.HtmlContentType(t, w) }
explode_data.jsonl/12543
{ "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, 4036, 11932, 1155, 353, 8840, 836, 8, 341, 59868, 1669, 67348, 83284, 2354, 76613, 198, 24395, 1669, 54320, 70334, 75274, 445, 3806, 497, 8879, 17305, 4283, 19270, 12627, 67, 21345, 497, 4479, 9910, 701, 2092, 340, 6692, 1669,...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
1
func TestSaveFieldList(t *testing.T) { got, err := saveDoc(&searchFields) if err != nil { t.Fatalf("saveDoc: %v", err) } want := protoFields if !reflect.DeepEqual(got.Field, want) { t.Errorf("\ngot %v\nwant %v", got, want) } }
explode_data.jsonl/27949
{ "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, 8784, 1877, 852, 1155, 353, 8840, 836, 8, 341, 3174, 354, 11, 1848, 1669, 3581, 9550, 2099, 1836, 8941, 340, 743, 1848, 961, 2092, 341, 197, 3244, 30762, 445, 6628, 9550, 25, 1018, 85, 497, 1848, 340, 197, 532, 50780, 16...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
3
func TestRaw(t *testing.T) { user1 := User{Name: "ExecRawSqlUser1", Age: 1, Birthday: parseTime("2000-1-1")} user2 := User{Name: "ExecRawSqlUser2", Age: 10, Birthday: parseTime("2010-1-1")} user3 := User{Name: "ExecRawSqlUser3", Age: 20, Birthday: parseTime("2020-1-1")} DB.Save(&user1).Save(&user2).Save(&user3) type result struct { Name string Email string } var ress []result DB.Raw("SELECT name, age FROM users WHERE name = ? or name = ?", user2.Name, user3.Name).Scan(&ress) if len(ress) != 2 || ress[0].Name != user2.Name || ress[1].Name != user3.Name { t.Errorf("Raw with scan") } rows, _ := DB.Raw("select name, age from users where name = ?", user3.Name).Rows() count := 0 for rows.Next() { count++ } if count != 1 { t.Errorf("Raw with Rows should find one record with name 3") } DB.Exec("update users set name=? where name in (?)", "jinzhu", []string{user1.Name, user2.Name, user3.Name}) if DB.Where("name in (?)", []string{user1.Name, user2.Name, user3.Name}).First(&User{}).Error != gorm.ErrRecordNotFound { t.Error("Raw sql to update records") } }
explode_data.jsonl/28050
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 427 }
[ 2830, 3393, 20015, 1155, 353, 8840, 836, 8, 341, 19060, 16, 1669, 2657, 63121, 25, 330, 10216, 20015, 8269, 1474, 16, 497, 13081, 25, 220, 16, 11, 36240, 25, 4715, 1462, 445, 17, 15, 15, 15, 12, 16, 12, 16, 42132, 19060, 17, 1669,...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
7
func TestParseSlowRate(t *testing.T) { tests := []struct { rate string want uint64 }{ { rate: "0 GB/sec", want: 0, }, { rate: "2.5 Gb/sec (1X SDR)", want: 312500000, }, { rate: "500 Gb/sec (4X HDR)", want: 62500000000, }, } for _, tt := range tests { rate, err := parseRate(tt.rate) if err != nil { t.Fatal(err) } if rate != tt.want { t.Errorf("Result for InfiniBand rate not correct: want %v, have %v", tt.want, rate) } } }
explode_data.jsonl/70525
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 239 }
[ 2830, 3393, 14463, 58289, 11564, 1155, 353, 8840, 836, 8, 341, 78216, 1669, 3056, 1235, 341, 197, 7000, 349, 914, 198, 197, 50780, 2622, 21, 19, 198, 197, 59403, 197, 197, 515, 298, 7000, 349, 25, 330, 15, 18865, 60071, 756, 298, 50...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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 TestBasicTypesValidation(t *testing.T) { GenerateValuesAsYaml(t, "basicTypesValidation.test.schema.json", func(console *tests.ConsoleWrapper, donec chan struct{}) { defer close(donec) console.ExpectString("Enter a value for numberValue") console.SendLine("abc") console.ExpectString("Sorry, your reply was invalid: unable to convert abc to float64") console.ExpectString("Enter a value for numberValue") console.SendLine("123.1") console.ExpectString("Enter a value for integerValue") console.SendLine("123.1") console.ExpectString("Sorry, your reply was invalid: unable to convert 123.1 to int") console.ExpectString("Enter a value for integerValue") console.SendLine("123") console.ExpectEOF() }) }
explode_data.jsonl/61750
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 255 }
[ 2830, 3393, 15944, 4173, 13799, 1155, 353, 8840, 836, 8, 341, 197, 31115, 6227, 2121, 56, 9467, 1155, 11, 330, 22342, 4173, 13799, 5958, 30892, 4323, 756, 197, 29244, 52818, 353, 23841, 46298, 11542, 11, 2814, 66, 26023, 2036, 28875, 34...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
1
func TestFindBest(t *testing.T) { u := format.Format{Name: "format", Unmarshaler: badUnmarshaler{}} tm := []struct { name string filename string format format.Format }{ { "empty", "", format.InvalidUnmarshaler, }, { "suffix", "a.format", u, }, { "prefix", "format.a", u, }, } for _, tt := range tm { t.Run(tt.name, func(t *testing.T) { f := format.FindBest(tt.filename) if tt.format != f { t.Errorf("wrong formatter; expected: %v; got: %v", tt.format, f) } }) } }
explode_data.jsonl/82022
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 271 }
[ 2830, 3393, 9885, 14470, 1155, 353, 8840, 836, 8, 341, 10676, 1669, 3561, 9978, 63121, 25, 330, 2243, 497, 1230, 27121, 261, 25, 3873, 1806, 27121, 261, 6257, 532, 3244, 76, 1669, 3056, 1235, 341, 197, 11609, 257, 914, 198, 197, 66434...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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 TestListBuckets(t *testing.T) { thisTime := time.Now() nowString := thisTime.Format("2006-01-02 15:04:05 Monday") t.Log("Starting unit test at " + nowString) // Build the request with its input parameters input := s3.ListBucketsInput{} api := &S3ListBucketsImpl{} resp, err := GetAllBuckets(context.Background(), *api, &input) if err != nil { t.Log("Got an error ...:") t.Log(err) return } t.Log("Got", len(resp.Buckets), "buckets:") for _, b := range resp.Buckets { t.Log(" " + *b.Name) } }
explode_data.jsonl/74384
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 211 }
[ 2830, 3393, 852, 33, 38551, 1155, 353, 8840, 836, 8, 341, 2046, 1462, 1669, 882, 13244, 741, 80922, 703, 1669, 419, 1462, 9978, 445, 17, 15, 15, 21, 12, 15, 16, 12, 15, 17, 220, 16, 20, 25, 15, 19, 25, 15, 20, 7014, 1138, 3244...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
3
func TestMySQLClusterService_Marshal(t *testing.T) { var entitiesUnmarshal []*MySQLClusterInfo asst := assert.New(t) s := initNewMySQLService() err := s.GetAll() asst.Nil(err, common.CombineMessageWithError("test Marshal() failed", err)) data, err := s.Marshal() asst.Nil(err, common.CombineMessageWithError("test Marshal() failed", err)) err = json.Unmarshal(data, &entitiesUnmarshal) asst.Nil(err, common.CombineMessageWithError("test Marshal() failed", err)) entities := s.GetMySQLClusters() for i := 0; i < len(entities); i++ { entity := entities[i] entityUnmarshal := entitiesUnmarshal[i] asst.True(equalMySQLClusterInfo(entity.(*MySQLClusterInfo), entityUnmarshal), common.CombineMessageWithError("test Marshal() failed", err)) } }
explode_data.jsonl/6159
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 279 }
[ 2830, 3393, 59224, 28678, 1860, 1245, 28423, 1155, 353, 8840, 836, 8, 341, 2405, 14744, 1806, 27121, 29838, 59224, 28678, 1731, 271, 60451, 267, 1669, 2060, 7121, 1155, 692, 1903, 1669, 2930, 3564, 59224, 1860, 741, 9859, 1669, 274, 45732...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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 TestGoBuildIsSupportedRefWithModules(t *testing.T) { base, err := random.Image(1024, 3) if err != nil { t.Fatalf("random.Image() = %v", err) } opts := []Option{ WithBaseImages(func(context.Context, string) (name.Reference, Result, error) { return baseRef, base, nil }), } ng, err := NewGo(context.Background(), "", opts...) if err != nil { t.Fatalf("NewGo() = %v", err) } // Supported import paths. for _, importpath := range []string{ "ko://github.com/google/ko/test", // ko can build the test package. "ko://github.com/go-training/helloworld", // ko can build commands in dependent modules } { t.Run(importpath, func(t *testing.T) { if err := ng.IsSupportedReference(importpath); err != nil { t.Errorf("IsSupportedReference(%q) = (%v), want nil", err, importpath) } }) } // Unsupported import paths. for _, importpath := range []string{ "ko://github.com/google/ko/pkg/build", // not a command. "ko://github.com/google/ko/pkg/nonexistent", // does not exist. "ko://github.com/google/go-github", // not in this module. } { t.Run(importpath, func(t *testing.T) { if err := ng.IsSupportedReference(importpath); err == nil { t.Errorf("IsSupportedReference(%v) = nil, want error", importpath) } }) } }
explode_data.jsonl/2480
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 499 }
[ 2830, 3393, 10850, 11066, 3872, 34636, 3945, 2354, 28201, 1155, 353, 8840, 836, 8, 341, 24195, 11, 1848, 1669, 4194, 7528, 7, 16, 15, 17, 19, 11, 220, 18, 340, 743, 1848, 961, 2092, 341, 197, 3244, 30762, 445, 11463, 7528, 368, 284,...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
1
func TestJumpHash(t *testing.T) { virtual := DefaultVirtual nodes := map[int]string{ 0: "0.0.0.0", // [0 - virtual) 1: "0.0.0.1", // [virtual - 2 * virtual) 2: "0.0.0.2", // [2 * virtual - 3 * virtual) } numBuckets := len(nodes) * virtual var hashF HashFunc = hash dist := map[string]int{ "0.0.0.0": 0, "0.0.0.1": 0, "0.0.0.2": 0, } numKey := 100000 buf := make([]byte, 12) for i := 0; i < numKey; i++ { _, err := rand.Read(buf) if err != nil { t.Fatal(err) } h := hashF([]byte(base64.StdEncoding.EncodeToString(buf))) n := JumpHash(uint64(h), numBuckets) switch n / int32(virtual) { case 0: dist[nodes[0]]++ case 1: dist[nodes[1]]++ case 2: dist[nodes[2]]++ } } ratios := make([]float64, 0, len(nodes)) for k, v := range dist { ratio := float64(v) / float64(numKey) ratios = append(ratios, ratio) t.Logf("%s: %0.3f", "jump hash: "+k, ratio) } for i := 0; i < len(ratios)-1; i++ { if !almostEqual(ratios[i], ratios[i+1], 0.01) { t.Fail() } } }
explode_data.jsonl/39409
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 512 }
[ 2830, 3393, 33979, 6370, 1155, 353, 8840, 836, 8, 341, 9558, 1669, 7899, 33026, 198, 79756, 1669, 2415, 18640, 30953, 515, 197, 197, 15, 25, 330, 15, 13, 15, 13, 15, 13, 15, 497, 442, 508, 15, 481, 4108, 340, 197, 197, 16, 25, 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...
9
func TestGetColor(t *testing.T) { tests := []struct { name string language string expected string }{ {name: "TestGetColor_1", language: "Go", expected: "#00ADD8"}, {name: "TestGetColor_2", language: "SomeRandom", expected: "#cccccc"}, {name: "TestGetColor_3", language: "HTML", expected: "#e34c26"}, {name: "TestGetColor_4", language: "HTML+PHP", expected: "#e34c26"}, } for _, test := range tests { color := GetColor(test.language) assert.Equal(t, test.expected, color, fmt.Sprintf("%v: is = %v, expected: %v", test.name, color, test.expected)) } }
explode_data.jsonl/20387
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 221 }
[ 2830, 3393, 1949, 1636, 1155, 353, 8840, 836, 8, 341, 78216, 1669, 3056, 1235, 341, 197, 11609, 257, 914, 198, 197, 8810, 2616, 914, 198, 197, 42400, 914, 198, 197, 59403, 197, 197, 47006, 25, 330, 2271, 1949, 1636, 62, 16, 497, 412...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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 TestListAllOpenShiftGroups(t *testing.T) { testCases := map[string]struct { startingGroups []runtime.Object blacklist []string expectedName string expectedErr string }{ "good": { startingGroups: []runtime.Object{ &userv1.Group{ObjectMeta: metav1.ObjectMeta{Name: "alpha", Annotations: map[string]string{ ldaputil.LDAPURLAnnotation: "test-host:port", ldaputil.LDAPUIDAnnotation: "alpha-uid", }, Labels: map[string]string{ldaputil.LDAPHostLabel: "test-host"}}}, }, expectedName: "alpha-uid", }, "no url annotation": { startingGroups: []runtime.Object{ &userv1.Group{ObjectMeta: metav1.ObjectMeta{Name: "alpha", Annotations: map[string]string{ldaputil.LDAPUIDAnnotation: "alpha-uid"}, Labels: map[string]string{ldaputil.LDAPHostLabel: "test-host"}}}, }, expectedErr: `group "alpha" marked as having been synced did not have an openshift.io/ldap.url annotation`, }, "no uid annotation": { startingGroups: []runtime.Object{ &userv1.Group{ObjectMeta: metav1.ObjectMeta{Name: "alpha", Annotations: map[string]string{ldaputil.LDAPURLAnnotation: "test-host:port"}, Labels: map[string]string{ldaputil.LDAPHostLabel: "test-host"}}}, }, expectedErr: `group "alpha" marked as having been synced did not have an openshift.io/ldap.uid annotation`, }, "no match: different port": { startingGroups: []runtime.Object{ &userv1.Group{ObjectMeta: metav1.ObjectMeta{Name: "alpha", Annotations: map[string]string{ ldaputil.LDAPURLAnnotation: "test-host:port2", ldaputil.LDAPUIDAnnotation: "alpha-uid", }, Labels: map[string]string{ldaputil.LDAPHostLabel: "test-host"}}}, &userv1.Group{ObjectMeta: metav1.ObjectMeta{Name: "beta", Annotations: map[string]string{ ldaputil.LDAPURLAnnotation: "test-host:port", ldaputil.LDAPUIDAnnotation: "beta-uid", }, Labels: map[string]string{ldaputil.LDAPHostLabel: "test-host"}}}, }, expectedName: "beta-uid", }, "blacklist": { startingGroups: []runtime.Object{ &userv1.Group{ObjectMeta: metav1.ObjectMeta{Name: "alpha", Annotations: map[string]string{ ldaputil.LDAPURLAnnotation: "test-host:port", ldaputil.LDAPUIDAnnotation: "alpha-uid", }, Labels: map[string]string{ldaputil.LDAPHostLabel: "test-host"}}}, &userv1.Group{ObjectMeta: metav1.ObjectMeta{Name: "beta", Annotations: map[string]string{ ldaputil.LDAPURLAnnotation: "test-host:port", ldaputil.LDAPUIDAnnotation: "beta-uid", }, Labels: map[string]string{ldaputil.LDAPHostLabel: "test-host"}}}, }, blacklist: []string{"alpha"}, expectedName: "beta-uid", }, } for name, testCase := range testCases { fakeClient := &fakeuserv1client.FakeUserV1{Fake: &(fakeuserclient.NewSimpleClientset(testCase.startingGroups...).Fake)} lister := NewAllOpenShiftGroupLister(testCase.blacklist, "test-host:port", fakeClient.Groups()) groupNames, err := lister.ListGroups() if err != nil { if len(testCase.expectedErr) == 0 { t.Errorf("%s: unexpected error: %v", name, err) } if expected, actual := testCase.expectedErr, err.Error(); expected != actual { t.Errorf("%s: expected error %v, got %v", name, expected, actual) } } else { if len(testCase.expectedErr) != 0 { t.Errorf("%s: expected error %v, got nil", name, testCase.expectedErr) } if expected, actual := []string{testCase.expectedName}, groupNames; !reflect.DeepEqual(expected, actual) { t.Errorf("%s: expected UIDs %v, got %v", name, expected, actual) } } } }
explode_data.jsonl/44134
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 1514 }
[ 2830, 3393, 852, 2403, 5002, 24841, 22173, 1155, 353, 8840, 836, 8, 341, 18185, 37302, 1669, 2415, 14032, 60, 1235, 341, 197, 21375, 287, 22173, 3056, 22255, 8348, 198, 197, 197, 11453, 1607, 414, 3056, 917, 198, 197, 42400, 675, 256, ...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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 TestInt64ArrayScanEmpty(t *testing.T) { var arr Int64Array err := arr.Scan(`{}`) if err != nil { t.Fatalf("Expected no error, got %v", err) } if arr == nil || len(arr) != 0 { t.Errorf("Expected empty, got %#v", arr) } }
explode_data.jsonl/5326
{ "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, 1072, 21, 19, 1857, 26570, 3522, 1155, 353, 8840, 836, 8, 341, 2405, 2890, 1333, 21, 19, 1857, 198, 9859, 1669, 2890, 54874, 5809, 90, 5541, 692, 743, 1848, 961, 2092, 341, 197, 3244, 30762, 445, 18896, 902, 1465, 11, 26...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
4
func TestMatchListings(t *testing.T) { var ( a = mockobject.Object("a") A = mockobject.Object("A") b = mockobject.Object("b") c = mockobject.Object("c") d = mockobject.Object("d") uE1 = mockobject.Object("é") // one of the unicode E characters uE2 = mockobject.Object("é") // a different unicode E character dirA = mockdir.New("A") dirb = mockdir.New("b") ) for _, test := range []struct { what string input fs.DirEntries // pairs of input src, dst srcOnly fs.DirEntries dstOnly fs.DirEntries matches []matchPair // pairs of output transforms []matchTransformFn }{ { what: "only src or dst", input: fs.DirEntries{ a, nil, b, nil, c, nil, d, nil, }, srcOnly: fs.DirEntries{ a, b, c, d, }, }, { what: "typical sync #1", input: fs.DirEntries{ a, nil, b, b, nil, c, nil, d, }, srcOnly: fs.DirEntries{ a, }, dstOnly: fs.DirEntries{ c, d, }, matches: []matchPair{ {b, b}, }, }, { what: "typical sync #2", input: fs.DirEntries{ a, a, b, b, nil, c, d, d, }, dstOnly: fs.DirEntries{ c, }, matches: []matchPair{ {a, a}, {b, b}, {d, d}, }, }, { what: "One duplicate", input: fs.DirEntries{ A, A, a, a, a, nil, b, b, }, matches: []matchPair{ {A, A}, {a, a}, {b, b}, }, }, { what: "Two duplicates", input: fs.DirEntries{ a, a, a, a, a, nil, }, matches: []matchPair{ {a, a}, }, }, { what: "Case insensitive duplicate - no transform", input: fs.DirEntries{ a, a, A, A, }, matches: []matchPair{ {A, A}, {a, a}, }, }, { what: "Case insensitive duplicate - transform to lower case", input: fs.DirEntries{ a, a, A, A, }, matches: []matchPair{ {A, A}, }, transforms: []matchTransformFn{strings.ToLower}, }, { what: "Unicode near-duplicate that becomes duplicate with normalization", input: fs.DirEntries{ uE1, uE1, uE2, uE2, }, matches: []matchPair{ {uE1, uE1}, }, transforms: []matchTransformFn{norm.NFC.String}, }, { what: "Unicode near-duplicate with no normalization", input: fs.DirEntries{ uE1, uE1, uE2, uE2, }, matches: []matchPair{ {uE1, uE1}, {uE2, uE2}, }, }, { what: "File and directory are not duplicates - srcOnly", input: fs.DirEntries{ dirA, nil, A, nil, }, srcOnly: fs.DirEntries{ dirA, A, }, }, { what: "File and directory are not duplicates - matches", input: fs.DirEntries{ dirA, dirA, A, A, }, matches: []matchPair{ {dirA, dirA}, {A, A}, }, }, { what: "Sync with directory #1", input: fs.DirEntries{ dirA, nil, A, nil, b, b, nil, c, nil, d, }, srcOnly: fs.DirEntries{ dirA, A, }, dstOnly: fs.DirEntries{ c, d, }, matches: []matchPair{ {b, b}, }, }, { what: "Sync with 2 directories", input: fs.DirEntries{ dirA, dirA, A, nil, nil, dirb, nil, b, }, srcOnly: fs.DirEntries{ A, }, dstOnly: fs.DirEntries{ dirb, b, }, matches: []matchPair{ {dirA, dirA}, }, }, } { t.Run(fmt.Sprintf("TestMatchListings-%s", test.what), func(t *testing.T) { var srcList, dstList fs.DirEntries for i := 0; i < len(test.input); i += 2 { src, dst := test.input[i], test.input[i+1] if src != nil { srcList = append(srcList, src) } if dst != nil { dstList = append(dstList, dst) } } srcOnly, dstOnly, matches := matchListings(srcList, dstList, test.transforms) assert.Equal(t, test.srcOnly, srcOnly, test.what, "srcOnly differ") assert.Equal(t, test.dstOnly, dstOnly, test.what, "dstOnly differ") assert.Equal(t, test.matches, matches, test.what, "matches differ") // now swap src and dst dstOnly, srcOnly, matches = matchListings(dstList, srcList, test.transforms) assert.Equal(t, test.srcOnly, srcOnly, test.what, "srcOnly differ") assert.Equal(t, test.dstOnly, dstOnly, test.what, "dstOnly differ") assert.Equal(t, test.matches, matches, test.what, "matches differ") }) } }
explode_data.jsonl/54653
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 2264 }
[ 2830, 3393, 8331, 852, 819, 1155, 353, 8840, 836, 8, 341, 2405, 2399, 197, 11323, 262, 284, 7860, 1700, 8348, 445, 64, 1138, 197, 22985, 262, 284, 7860, 1700, 8348, 445, 32, 1138, 197, 2233, 262, 284, 7860, 1700, 8348, 445, 65, 1138...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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 TestSetDefaultProfileImage(t *testing.T) { th := Setup().InitBasic().InitSystemAdmin() defer th.TearDown() Client := th.Client user := th.BasicUser ok, resp := Client.SetDefaultProfileImage(user.Id) if !ok { t.Fatal(resp.Error) } CheckNoError(t, resp) ok, resp = Client.SetDefaultProfileImage(model.NewId()) if ok { t.Fatal("Should return false, set profile image not allowed") } CheckForbiddenStatus(t, resp) // status code returns either forbidden or unauthorized // note: forbidden is set as default at Client4.SetDefaultProfileImage when request is terminated early by server Client.Logout() _, resp = Client.SetDefaultProfileImage(user.Id) if resp.StatusCode == http.StatusForbidden { CheckForbiddenStatus(t, resp) } else if resp.StatusCode == http.StatusUnauthorized { CheckUnauthorizedStatus(t, resp) } else { t.Fatal("Should have failed either forbidden or unauthorized") } _, resp = th.SystemAdminClient.SetDefaultProfileImage(user.Id) CheckNoError(t, resp) ruser, err := th.App.GetUser(user.Id) require.Nil(t, err) assert.Equal(t, int64(0), ruser.LastPictureUpdate, "Picture should have resetted to default") info := &model.FileInfo{Path: "users/" + user.Id + "/profile.png"} if err := th.cleanupTestFile(info); err != nil { t.Fatal(err) } }
explode_data.jsonl/21555
{ "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, 1649, 3675, 8526, 1906, 1155, 353, 8840, 836, 8, 341, 70479, 1669, 18626, 1005, 3803, 15944, 1005, 3803, 2320, 7210, 741, 16867, 270, 836, 682, 4454, 741, 71724, 1669, 270, 11716, 198, 19060, 1669, 270, 48868, 1474, 271, 592...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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 TestCollectionReplica_getCollectionNum(t *testing.T) { node := newQueryNodeMock() initTestMeta(t, node, 0, 0) assert.Equal(t, node.historical.replica.getCollectionNum(), 1) err := node.Stop() assert.NoError(t, err) }
explode_data.jsonl/11477
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 85 }
[ 2830, 3393, 6482, 18327, 15317, 3062, 6482, 4651, 1155, 353, 8840, 836, 8, 341, 20831, 1669, 501, 2859, 1955, 11571, 741, 28248, 2271, 12175, 1155, 11, 2436, 11, 220, 15, 11, 220, 15, 340, 6948, 12808, 1155, 11, 2436, 860, 95698, 6822...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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 TestSendUploadPart(t *testing.T) { ts := httptest.NewServer(http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) { if r.Method != "POST" { t.Errorf("unexpected method. want=%s have=%s", "POST", r.Method) } if r.URL.Path != "/uploads/42/3" { t.Errorf("unexpected method. want=%s have=%s", "/uploads/42/3", r.URL.Path) } if content, err := ioutil.ReadAll(r.Body); err != nil { t.Fatalf("unexpected error reading payload: %s", err) } else if diff := cmp.Diff([]byte("payload\n"), content); diff != "" { t.Errorf("unexpected request payload (-want +got):\n%s", diff) } w.Write([]byte(`{"size": 100}`)) })) defer ts.Close() client := &bundleManagerClientImpl{bundleManagerURL: ts.URL} err := client.SendUploadPart(context.Background(), 42, 3, bytes.NewReader([]byte("payload\n"))) if err != nil { t.Fatalf("unexpected error sending upload: %s", err) } }
explode_data.jsonl/21424
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 359 }
[ 2830, 3393, 11505, 13844, 5800, 1155, 353, 8840, 836, 8, 341, 57441, 1669, 54320, 70334, 7121, 5475, 19886, 89164, 18552, 3622, 1758, 37508, 11, 435, 353, 1254, 9659, 8, 341, 197, 743, 435, 20798, 961, 330, 2946, 1, 341, 298, 3244, 13...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
5
func TestExifEditor_SetIfdExifTag(t *testing.T) { //TODO: make sure to cover all various types as well non-happy paths expectedFocalLength := URat{350, 10} je := getJpegEditor(LeicaImg, t) if err := je.Exif().SetIfdExifTag(ExifIFD_FocalLength, expectedFocalLength); err != nil { t.Fatalf("Could not set exif tag: %v", err) } md := jpegEditorMD(je, t) focalLength := URat{} if err := md.exifData.ScanIfdExif(ExifIFD_FocalLength, &focalLength); err != nil { t.Errorf("Could not scan ifdexif: %v", err) } if focalLength != expectedFocalLength { t.Errorf("expected focalLength %v got %v", expectedFocalLength, focalLength) } }
explode_data.jsonl/79883
{ "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, 840, 333, 9410, 14812, 2679, 67, 840, 333, 5668, 1155, 353, 8840, 836, 8, 341, 197, 322, 14732, 25, 1281, 2704, 311, 3421, 678, 5257, 4494, 438, 1632, 2477, 2832, 11144, 12716, 198, 42400, 37, 3683, 4373, 1669, 34414, 266,...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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 TestStreamingFail(t *testing.T) { trace.ApplyConfig(trace.Config{DefaultSampler: trace.AlwaysSample()}) te := testExporter{make(chan *trace.SpanData)} trace.RegisterExporter(&te) defer trace.UnregisterExporter(&te) client, cleanup := testpb.NewTestClient(t) stream, err := client.Multiple(context.Background()) if err != nil { t.Fatalf("Call failed: %v", err) } err = stream.Send(&testpb.FooRequest{Fail: true}) if err != nil { t.Fatalf("Couldn't send streaming request: %v", err) } stream.CloseSend() for { _, err := stream.Recv() if err == nil || err == io.EOF { t.Errorf("stream.Recv() = %v; want errors", err) } else { break } } s1 := <-te.ch s2 := <-te.ch checkSpanData(t, s1, s2, "testpb.Foo.Multiple", false) cleanup() select { case <-te.ch: t.Fatal("received extra exported spans") case <-time.After(time.Second / 10): } }
explode_data.jsonl/27159
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 351 }
[ 2830, 3393, 76509, 19524, 1155, 353, 8840, 836, 8, 341, 65058, 36051, 2648, 55458, 10753, 90, 3675, 66048, 25, 11655, 9636, 2284, 17571, 96503, 197, 665, 1669, 1273, 88025, 90, 6927, 35190, 353, 15067, 85309, 1043, 10569, 65058, 19983, 88...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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 TestProvider_FetchRepoPerms(t *testing.T) { t.Run("nil repository", func(t *testing.T) { p := NewProvider("", mustURL(t, "https://github.com"), "admin_token", nil, 3*time.Hour, nil) _, err := p.FetchRepoPerms(context.Background(), nil) want := "no repository provided" got := fmt.Sprintf("%v", err) if got != want { t.Fatalf("err: want %q but got %q", want, got) } }) t.Run("not the code host of the repository", func(t *testing.T) { p := NewProvider("", mustURL(t, "https://github.com"), "admin_token", nil, 3*time.Hour, nil) _, err := p.FetchRepoPerms(context.Background(), &extsvc.Repository{ URI: "gitlab.com/user/repo", ExternalRepoSpec: api.ExternalRepoSpec{ ServiceType: "gitlab", ServiceID: "https://gitlab.com/", }, }, ) want := `not a code host of the repository: want "https://gitlab.com/" but have "https://github.com/"` got := fmt.Sprintf("%v", err) if got != want { t.Fatalf("err: want %q but got %q", want, got) } }) p := NewProvider("", mustURL(t, "https://github.com"), "admin_token", nil, 3*time.Hour, nil) p.client = &mockClient{ MockListRepositoryCollaborators: func(ctx context.Context, owner, repo string, page int) ([]*github.Collaborator, bool, error) { switch page { case 1: return []*github.Collaborator{ {DatabaseID: 57463526}, {DatabaseID: 67471}, }, true, nil case 2: return []*github.Collaborator{ {DatabaseID: 187831}, }, false, nil } return []*github.Collaborator{}, false, nil }, } accountIDs, err := p.FetchRepoPerms(context.Background(), &extsvc.Repository{ URI: "github.com/user/repo", ExternalRepoSpec: api.ExternalRepoSpec{ ID: "github_project_id", ServiceType: "github", ServiceID: "https://github.com/", }, }, ) if err != nil { t.Fatal(err) } wantAccountIDs := []extsvc.AccountID{ "57463526", "67471", "187831", } if diff := cmp.Diff(wantAccountIDs, accountIDs); diff != "" { t.Fatalf("AccountIDs mismatch (-want +got):\n%s", diff) } }
explode_data.jsonl/7242
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 879 }
[ 2830, 3393, 5179, 1400, 2995, 25243, 3889, 1011, 1155, 353, 8840, 836, 8, 341, 3244, 16708, 445, 8385, 12542, 497, 2915, 1155, 353, 8840, 836, 8, 341, 197, 3223, 1669, 1532, 5179, 19814, 1969, 3144, 1155, 11, 330, 2428, 1110, 5204, 90...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
2
func TestTopicTrie_preOrderTraverse(t *testing.T) { //a := assert.New(t) trie := newTopicTrie() for _, v := range testPreOrderTraverse.topics { trie.subscribe(testPreOrderTraverse.clientID, v) } trie.subscribe("abcd", packets.Topic{ Qos: 2, Name: "a/b/c", }) trie.preOrderTraverse(func(clientID string, topic packets.Topic) bool { return true }) }
explode_data.jsonl/72947
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 151 }
[ 2830, 3393, 26406, 51, 7231, 10442, 4431, 1282, 22439, 1155, 353, 8840, 836, 8, 341, 197, 322, 64, 1669, 2060, 7121, 1155, 340, 197, 8927, 1669, 501, 26406, 51, 7231, 741, 2023, 8358, 348, 1669, 2088, 1273, 4703, 4431, 1282, 22439, 87...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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 TestUpgradeFromPrevNoData(t *testing.T) { upgradedDbInfo := getUpgradedDbInfo(t, true) pristineDbInfo := getPristineDbInfo(t, true) if !reflect.DeepEqual(pristineDbInfo, upgradedDbInfo) { printDbInfoDifferences(t, pristineDbInfo, upgradedDbInfo) } }
explode_data.jsonl/29078
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 94 }
[ 2830, 3393, 43861, 3830, 33528, 2753, 1043, 1155, 353, 8840, 836, 8, 341, 59810, 23343, 7994, 1731, 1669, 633, 2324, 23343, 7994, 1731, 1155, 11, 830, 340, 25653, 53065, 7994, 1731, 1669, 57720, 2819, 482, 7994, 1731, 1155, 11, 830, 692...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
2
func TestCalcUnbindOng(t *testing.T) { assert.Equal(t, CalcUnbindOng(1, 0, 1), uint64(GENERATION_AMOUNT[0])) assert.Equal(t, CalcUnbindOng(1, 0, TIME_INTERVAL), GENERATION_AMOUNT[0]*uint64(TIME_INTERVAL)) assert.Equal(t, CalcUnbindOng(1, 0, TIME_INTERVAL+1), GENERATION_AMOUNT[1]+GENERATION_AMOUNT[0]*uint64(TIME_INTERVAL)) }
explode_data.jsonl/65993
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 153 }
[ 2830, 3393, 47168, 1806, 7666, 46, 968, 1155, 353, 8840, 836, 8, 341, 6948, 12808, 1155, 11, 34215, 1806, 7666, 46, 968, 7, 16, 11, 220, 15, 11, 220, 16, 701, 2622, 21, 19, 6699, 12265, 3495, 59993, 58, 15, 10907, 6948, 12808, 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...
1
func TestConfigPath(t *testing.T) { os.Unsetenv(xdg.ConfigHomeEnvVar) os.Setenv("APPDATA", filepath.Join(homedir.HomeDir(), "foo")) expected := filepath.Join(homedir.HomeDir(), "foo", appName, testFile) if lazy.configPath(testFile) != expected { t.Errorf("expected '%s', got '%s'", expected, lazy.configPath(testFile)) } os.Setenv(xdg.ConfigHomeEnvVar, filepath.Join(homedir.HomeDir(), "xdg")) expected = filepath.Join(homedir.HomeDir(), "xdg", appName, testFile) if lazy.configPath(testFile) != expected { t.Errorf("expected '%s', got '%s'", expected, lazy.configPath(testFile)) } }
explode_data.jsonl/5285
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 232 }
[ 2830, 3393, 2648, 1820, 1155, 353, 8840, 836, 8, 341, 25078, 10616, 746, 3160, 2075, 35138, 10753, 7623, 14359, 3962, 340, 25078, 4202, 3160, 445, 14707, 17777, 497, 26054, 22363, 3203, 24139, 404, 59965, 6184, 1507, 330, 7975, 28075, 424...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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 TestStringJSON(t *testing.T) { input := []struct { plain string value String }{ { plain: `[123.456,"test"]`, value: String{ Timestamp: 123456, Value: "test", }, }, { plain: `[123123.456,"台北"]`, value: String{ Timestamp: 123123456, Value: "台北", }, }, } for _, test := range input { b, err := json.Marshal(test.value) if err != nil { t.Error(err) continue } if string(b) != test.plain { t.Errorf("encoding error: expected %q, got %q", test.plain, b) continue } var sv String err = json.Unmarshal(b, &sv) if err != nil { t.Error(err) continue } if sv != test.value { t.Errorf("decoding error: expected %v, got %v", test.value, sv) } } }
explode_data.jsonl/45166
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 363 }
[ 2830, 3393, 703, 5370, 1155, 353, 8840, 836, 8, 341, 22427, 1669, 3056, 1235, 341, 197, 197, 20772, 914, 198, 197, 16309, 923, 198, 197, 59403, 197, 197, 515, 298, 197, 20772, 25, 77644, 16, 17, 18, 13, 19, 20, 21, 1335, 1944, 134...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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 TestSplitOid(t *testing.T) { cases := []struct { oid []int count int resultHead []int resultTail []int }{ { oid: []int{1, 2, 3, 4}, count: 2, resultHead: []int{1, 2}, resultTail: []int{3, 4}, }, { oid: []int{1, 2}, count: 4, resultHead: []int{1, 2, 0, 0}, resultTail: []int{}, }, { oid: []int{}, count: 2, resultHead: []int{0, 0}, resultTail: []int{}, }, } for _, c := range cases { head, tail := splitOid(c.oid, c.count) if !reflect.DeepEqual(head, c.resultHead) || !reflect.DeepEqual(tail, c.resultTail) { t.Errorf("splitOid(%v, %d): got [%v, %v], want [%v, %v]", c.oid, c.count, head, tail, c.resultHead, c.resultTail) } } }
explode_data.jsonl/52018
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 405 }
[ 2830, 3393, 20193, 46, 307, 1155, 353, 8840, 836, 8, 341, 1444, 2264, 1669, 3056, 1235, 341, 197, 197, 588, 286, 3056, 396, 198, 197, 18032, 414, 526, 198, 197, 9559, 12346, 3056, 396, 198, 197, 9559, 44795, 3056, 396, 198, 197, 594...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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 TestEBSVolume(t *testing.T) { ctx := context.Background() sess := mock.Session mockVolumeClient := &mockEBSVolumeClient{ success: make(chan bool), } clientOption := func(e *ebsVolume) { e.client = mockVolumeClient } maxJitterOption := func(e *ebsVolume) { e.maxJitterTime = time.Millisecond } hostMountsOption := func(e *ebsVolume) { e.hostMounts = "./testdata/mounts" } LstatOption := func(e *ebsVolume) { e.osLstat = func(name string) (os.FileInfo, error) { if name == hostProc { return &mockFileInfo{}, nil } return &mockFileInfo{}, nil } } evalSymLinksOption := func(e *ebsVolume) { e.evalSymLinks = func(path string) (string, error) { if strings.HasSuffix(path, "/dev/xvdb") { return "/dev/nvme0n2", nil } return "", errors.New("error") } } e := newEBSVolume(ctx, sess, "instanceId", "us-west-2", time.Millisecond, zap.NewNop(), clientOption, maxJitterOption, hostMountsOption, LstatOption, evalSymLinksOption) <-mockVolumeClient.success assert.Equal(t, "aws://us-west-2/vol-0303a1cc896c42d28", e.getEBSVolumeID("/dev/xvdc")) assert.Equal(t, "aws://us-west-2/vol-0c241693efb58734a", e.getEBSVolumeID("/dev/nvme0n2")) assert.Equal(t, "", e.getEBSVolumeID("/dev/invalid")) ebsIds := e.extractEbsIDsUsedByKubernetes() assert.Equal(t, 1, len(ebsIds)) assert.Equal(t, "aws://us-west-2b/vol-0d9f0816149eb2050", ebsIds["/dev/nvme1n1"]) //set e.hostMounts to an invalid path hostMountsOption = func(e *ebsVolume) { e.hostMounts = "/an-invalid-path" } e = newEBSVolume(ctx, sess, "instanceId", "us-west-2", time.Millisecond, zap.NewNop(), clientOption, maxJitterOption, hostMountsOption, LstatOption, evalSymLinksOption) ebsIds = e.extractEbsIDsUsedByKubernetes() assert.Equal(t, 0, len(ebsIds)) }
explode_data.jsonl/42397
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 772 }
[ 2830, 3393, 36, 7347, 18902, 1155, 353, 8840, 836, 8, 341, 20985, 1669, 2266, 19047, 741, 1903, 433, 1669, 7860, 20674, 198, 77333, 18902, 2959, 1669, 609, 16712, 36, 7347, 18902, 2959, 515, 197, 30553, 25, 1281, 35190, 1807, 1326, 197,...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
1
func Test_dkTags_checkAllTagsKey(t *testing.T) { type fields struct { tags map[string]string } tests := []struct { name string fields fields want *dkTags }{ { name: "case", fields: fields{tags: map[string]string{"a.b": "c"}}, want: &dkTags{ tags: map[string]string{"a.b": "c"}, replaceTags: map[string]string{"a_b": "c"}, }, }, } for _, tt := range tests { t.Run(tt.name, func(t *testing.T) { dt := &dkTags{ tags: tt.fields.tags, replaceTags: map[string]string{}, } if got := dt.checkAllTagsKey(); !reflect.DeepEqual(got, tt.want) { t.Errorf("checkAllTagsKey() = %v, want %v", got, tt.want) } }) } }
explode_data.jsonl/14401
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 332 }
[ 2830, 3393, 814, 74, 15930, 7200, 2403, 15930, 1592, 1155, 353, 8840, 836, 8, 341, 13158, 5043, 2036, 341, 197, 3244, 2032, 2415, 14032, 30953, 198, 197, 532, 78216, 1669, 3056, 1235, 341, 197, 11609, 256, 914, 198, 197, 55276, 5043, ...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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 TestAgentRestart(t *testing.T) { a, dir := newTestAgent(t) defer a.terminate() err := a.start("-data-dir", dir) if err != nil { t.Fatal(err) } err = a.stop() if err != nil { t.Fatal(err) } err = a.restart() if err != nil { t.Fatal(err) } }
explode_data.jsonl/75545
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 128 }
[ 2830, 3393, 16810, 59354, 1155, 353, 8840, 836, 8, 341, 11323, 11, 5419, 1669, 501, 2271, 16810, 1155, 340, 16867, 264, 98942, 2822, 9859, 1669, 264, 4962, 13645, 691, 45283, 497, 5419, 340, 743, 1848, 961, 2092, 341, 197, 3244, 26133, ...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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 TestKubernetesSelectors(t *testing.T) { _, err := LoadFile("testdata/kubernetes_selectors_endpoints.good.yml") require.NoError(t, err) _, err = LoadFile("testdata/kubernetes_selectors_node.good.yml") require.NoError(t, err) _, err = LoadFile("testdata/kubernetes_selectors_ingress.good.yml") require.NoError(t, err) _, err = LoadFile("testdata/kubernetes_selectors_pod.good.yml") require.NoError(t, err) _, err = LoadFile("testdata/kubernetes_selectors_service.good.yml") require.NoError(t, err) }
explode_data.jsonl/81277
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 210 }
[ 2830, 3393, 42, 29827, 96995, 1155, 353, 8840, 836, 8, 341, 197, 6878, 1848, 1669, 8893, 1703, 445, 92425, 79587, 13051, 1087, 6213, 7706, 59569, 33936, 1138, 17957, 35699, 1155, 11, 1848, 340, 197, 6878, 1848, 284, 8893, 1703, 445, 924...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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 TestServer_FileDelete(t *testing.T) { token, trx, down, err := models.NewArbitrarilyTokenForTest(nil, t) assert.Nil(t, err) testDbConn = trx tempDir := models.NewTempDirForTest() testRootPath = &tempDir defer func() { down(t) if util.IsDir(tempDir) { os.RemoveAll(tempDir) } }() p := "/" + path.Join("", models.RandomWithMD5(22), "r.bytes") randomBytes := models.Random(222) randomBytesHash, err := util.Sha256Hash2String(randomBytes) assert.Nil(t, err) file, err := models.CreateFileFromReader(&token.App, p, bytes.NewReader(randomBytes), int8(0), testRootPath, trx) assert.Nil(t, err) req := &FileDeleteRequest{ Token: token.UID, FileUid: file.UID, } s := Server{} resp, err := s.FileDelete(newContext(context.Background()), req) assert.Nil(t, err) assert.Equal(t, p, resp.File.Path) assert.Equal(t, randomBytesHash, resp.File.Hash.GetValue()) assert.NotNil(t, resp.File.GetDeletedAt()) req.Token = "" _, err = s.FileDelete(newContext(context.Background()), req) assert.NotNil(t, err) req.Token = token.UID req.FileUid = "" _, err = s.FileDelete(newContext(context.Background()), req) assert.NotNil(t, err) req.FileUid = file.UID assert.Nil(t, trx.Unscoped().Model(file).Update("deletedAt", nil).Error) assert.Nil(t, trx.Model(token).Update("path", "/hello").Error) _, err = s.FileDelete(newContext(context.Background()), req) assert.NotNil(t, err) statusError, ok := status.FromError(err) assert.True(t, ok) assert.Contains(t, statusError.Message(), models.ErrAccessDenied.Error()) }
explode_data.jsonl/30084
{ "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, 5475, 34061, 6435, 1155, 353, 8840, 836, 8, 341, 43947, 11, 73021, 11, 1495, 11, 1848, 1669, 4119, 7121, 6953, 4489, 81, 6613, 3323, 2461, 2271, 27907, 11, 259, 340, 6948, 59678, 1155, 11, 1848, 340, 18185, 7994, 9701, 284...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
2
func TestCreatePost(t *testing.T) { t.Run("call PreparePostForClient before returning", func(t *testing.T) { th := Setup(t).InitBasic() defer th.TearDown() th.App.UpdateConfig(func(cfg *model.Config) { *cfg.ServiceSettings.SiteURL = "http://mymattermost.com" *cfg.ImageProxySettings.Enable = true *cfg.ImageProxySettings.ImageProxyType = "atmos/camo" *cfg.ImageProxySettings.RemoteImageProxyURL = "https://127.0.0.1" *cfg.ImageProxySettings.RemoteImageProxyOptions = "foo" }) th.Server.ImageProxy = imageproxy.MakeImageProxy(th.Server, th.Server.HTTPService, th.Server.Log) imageURL := "http://mydomain.com/myimage" proxiedImageURL := "http://mymattermost.com/api/v4/image?url=http%3A%2F%2Fmydomain.com%2Fmyimage" post := &model.Post{ ChannelId: th.BasicChannel.Id, Message: "![image](" + imageURL + ")", UserId: th.BasicUser.Id, } rpost, err := th.App.CreatePost(th.Context, post, th.BasicChannel, false, true) require.Nil(t, err) assert.Equal(t, "![image]("+proxiedImageURL+")", rpost.Message) }) t.Run("Sets prop MENTION_HIGHLIGHT_DISABLED when it should", func(t *testing.T) { th := Setup(t).InitBasic() defer th.TearDown() th.AddUserToChannel(th.BasicUser, th.BasicChannel) t.Run("Does not set prop when user has USE_CHANNEL_MENTIONS", func(t *testing.T) { postWithNoMention := &model.Post{ ChannelId: th.BasicChannel.Id, Message: "This post does not have mentions", UserId: th.BasicUser.Id, } rpost, err := th.App.CreatePost(th.Context, postWithNoMention, th.BasicChannel, false, true) require.Nil(t, err) assert.Equal(t, rpost.GetProps(), model.StringInterface{}) postWithMention := &model.Post{ ChannelId: th.BasicChannel.Id, Message: "This post has @here mention @all", UserId: th.BasicUser.Id, } rpost, err = th.App.CreatePost(th.Context, postWithMention, th.BasicChannel, false, true) require.Nil(t, err) assert.Equal(t, rpost.GetProps(), model.StringInterface{}) }) t.Run("Sets prop when post has mentions and user does not have USE_CHANNEL_MENTIONS", func(t *testing.T) { th.RemovePermissionFromRole(model.PERMISSION_USE_CHANNEL_MENTIONS.Id, model.CHANNEL_USER_ROLE_ID) th.RemovePermissionFromRole(model.PERMISSION_USE_CHANNEL_MENTIONS.Id, model.CHANNEL_ADMIN_ROLE_ID) postWithNoMention := &model.Post{ ChannelId: th.BasicChannel.Id, Message: "This post does not have mentions", UserId: th.BasicUser.Id, } rpost, err := th.App.CreatePost(th.Context, postWithNoMention, th.BasicChannel, false, true) require.Nil(t, err) assert.Equal(t, rpost.GetProps(), model.StringInterface{}) postWithMention := &model.Post{ ChannelId: th.BasicChannel.Id, Message: "This post has @here mention @all", UserId: th.BasicUser.Id, } rpost, err = th.App.CreatePost(th.Context, postWithMention, th.BasicChannel, false, true) require.Nil(t, err) assert.Equal(t, rpost.GetProp(model.POST_PROPS_MENTION_HIGHLIGHT_DISABLED), true) th.AddPermissionToRole(model.PERMISSION_USE_CHANNEL_MENTIONS.Id, model.CHANNEL_USER_ROLE_ID) th.AddPermissionToRole(model.PERMISSION_USE_CHANNEL_MENTIONS.Id, model.CHANNEL_ADMIN_ROLE_ID) }) }) }
explode_data.jsonl/26435
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 1331 }
[ 2830, 3393, 4021, 4133, 1155, 353, 8840, 836, 8, 341, 3244, 16708, 445, 6659, 31166, 4133, 2461, 2959, 1573, 13451, 497, 2915, 1155, 353, 8840, 836, 8, 341, 197, 70479, 1669, 18626, 1155, 568, 3803, 15944, 741, 197, 16867, 270, 836, 6...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
1
func TestBind(t *testing.T) { keymap := defaultKeymap() check := func(event tui.Event, arg1 string, types ...actionType) { if len(keymap[event]) != len(types) { t.Errorf("invalid number of actions for %v (%d != %d)", event, len(types), len(keymap[event])) return } for idx, action := range keymap[event] { if types[idx] != action.t { t.Errorf("invalid action type (%d != %d)", types[idx], action.t) } } if len(arg1) > 0 && keymap[event][0].a != arg1 { t.Errorf("invalid action argument: (%s != %s)", arg1, keymap[event][0].a) } } check(tui.CtrlA.AsEvent(), "", actBeginningOfLine) parseKeymap(keymap, "ctrl-a:kill-line,ctrl-b:toggle-sort+up+down,c:page-up,alt-z:page-down,"+ "f1:execute(ls {+})+abort+execute(echo {+})+select-all,f2:execute/echo {}, {}, {}/,f3:execute[echo '({})'],f4:execute;less {};,"+ "alt-a:execute-Multi@echo (,),[,],/,:,;,%,{}@,alt-b:execute;echo (,),[,],/,:,@,%,{};,"+ "x:Execute(foo+bar),X:execute/bar+baz/"+ ",f1:+first,f1:+top"+ ",,:abort,::accept,+:execute:++\nfoobar,Y:execute(baz)+up") check(tui.CtrlA.AsEvent(), "", actKillLine) check(tui.CtrlB.AsEvent(), "", actToggleSort, actUp, actDown) check(tui.Key('c'), "", actPageUp) check(tui.Key(','), "", actAbort) check(tui.Key(':'), "", actAccept) check(tui.AltKey('z'), "", actPageDown) check(tui.F1.AsEvent(), "ls {+}", actExecute, actAbort, actExecute, actSelectAll, actFirst, actFirst) check(tui.F2.AsEvent(), "echo {}, {}, {}", actExecute) check(tui.F3.AsEvent(), "echo '({})'", actExecute) check(tui.F4.AsEvent(), "less {}", actExecute) check(tui.Key('x'), "foo+bar", actExecute) check(tui.Key('X'), "bar+baz", actExecute) check(tui.AltKey('a'), "echo (,),[,],/,:,;,%,{}", actExecuteMulti) check(tui.AltKey('b'), "echo (,),[,],/,:,@,%,{}", actExecute) check(tui.Key('+'), "++\nfoobar,Y:execute(baz)+up", actExecute) for idx, char := range []rune{'~', '!', '@', '#', '$', '%', '^', '&', '*', '|', ';', '/'} { parseKeymap(keymap, fmt.Sprintf("%d:execute%cfoobar%c", idx%10, char, char)) check(tui.Key([]rune(fmt.Sprintf("%d", idx%10))[0]), "foobar", actExecute) } parseKeymap(keymap, "f1:abort") check(tui.F1.AsEvent(), "", actAbort) }
explode_data.jsonl/40868
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 1022 }
[ 2830, 3393, 9950, 1155, 353, 8840, 836, 8, 341, 23634, 2186, 1669, 1638, 1592, 2186, 741, 25157, 1669, 2915, 6235, 259, 1963, 6904, 11, 1392, 16, 914, 11, 4494, 2503, 1311, 929, 8, 341, 197, 743, 2422, 4857, 2186, 54799, 2467, 961, ...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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 TestHttpParser_splitResponse_midBody(t *testing.T) { http := HttpModForTests() data1 := []byte("HTTP/1.1 200 OK\r\n" + "Date: Tue, 14 Aug 2012 22:31:45 GMT\r\n" + "Expires: -1\r\n" + "Cache-Control: private, max-age=0\r\n" + "Content-Type: text/html; charset=UTF-8\r\n" + "Content-Encoding: gzip\r\n" + "Server: gws\r\n" + "Content-Length: 3") data2 := []byte("0\r\n" + "X-XSS-Protection: 1; mode=block\r\n" + "X-Frame-Options: SAMEORIGIN\r\n" + "\r\n" + "xxxxxxxxxx") data3 := []byte("xxxxxxxxxxxxxxxxxxxx") stream := &HttpStream{data: data1, message: new(HttpMessage)} ok, complete := http.messageParser(stream) if !ok { t.Errorf("Parsing returned error") } if complete { t.Errorf("Not expecting a complete message yet") } stream.data = append(stream.data, data2...) ok, complete = http.messageParser(stream) if !ok { t.Errorf("Parsing returned error") } if complete { t.Errorf("Not expecting a complete message yet") } stream.data = append(stream.data, data3...) ok, complete = http.messageParser(stream) if !ok { t.Errorf("Parsing returned error") } if !complete { t.Errorf("Expecting a complete message") } if stream.message.ContentLength != 30 { t.Errorf("Wrong content-length") } if !bytes.Equal(stream.data[stream.parseOffset:], []byte("")) { t.Errorf("The offset is wrong") } }
explode_data.jsonl/6838
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 560 }
[ 2830, 3393, 2905, 6570, 17052, 2582, 43733, 5444, 1155, 353, 8840, 836, 8, 341, 28080, 1669, 4823, 4459, 2461, 18200, 2822, 8924, 16, 1669, 3056, 3782, 445, 9230, 14, 16, 13, 16, 220, 17, 15, 15, 10402, 12016, 1699, 1, 3610, 197, 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...
9
func TestReadMessage(t *testing.T) { mockCtrl := gomock.NewController(t) defer mockCtrl.Finish() assert := assert.New(t) cases := []struct { name string txData []byte expectedID string err string decrypterLocationCalls int decrypterLocationRet []interface{} decrypterContentsCalls int decrypterFile string decrypterContentsError error }{ {"invalid protobuf prefix", testutil.MustHexDecodeString("08010f7365637265742d6c6f636174696f6e1a221620aff34d74dcb62c288b1a2f41a4852e82aff6c95e5c40c891299b3488b4340769"), "", "invalid encoding prefix", 0, []interface{}{[]byte("test://TestReadMessage/success-2204f3d89e5a"), nil}, 0, "", nil, }, {"invalid protobuf format", testutil.MustHexDecodeString("5008010f7365637265742d6c6f636174696f6e1a221620aff34d74dcb62c288b1a2f41a4852e82aff6c95e5c40c891299b3488b4340769"), "", "could not unmarshal to data: proto: can't skip unknown wire type 7", 0, []interface{}{[]byte("test://TestReadMessage/success-2204f3d89e5a"), nil}, 0, "", nil, }, {"fail decrypted location", testutil.MustHexDecodeString("500801120f7365637265742d6c6f636174696f6e1a221620aff34d74dcb62c288b1a2f41a4852e82aff6c95e5c40c891299b3488b4340769"), "", "could not decrypt location: could not decrypt", 1, []interface{}{nil, errors.New("could not decrypt")}, 0, "", nil, }, {"no-message-at-location", testutil.MustHexDecodeString("500801120f7365637265742d6c6f636174696f6e1a221620aff34d74dcb62c288b1a2f41a4852e82aff6c95e5c40c891299b3488b4340769"), "002c47eca011e32b52c71005ad8a8f75e1b44c92c99fd12e43bccfe571e3c2d13d2e9a826a550f5ff63b247af471", "could not get message from `location`: open TestReadMessage/no_message_at_location-2204f3d89e5a: no such file or directory", 1, []interface{}{[]byte("file://TestReadMessage/no_message_at_location-2204f3d89e5a"), nil}, 0, "no_message_at_location.golden.eml", nil, }, {"decrypt-message-failed", testutil.MustHexDecodeString("500801120f7365637265742d6c6f636174696f6e1a221620aff34d74dcb62c288b1a2f41a4852e82aff6c95e5c40c891299b3488b4340769"), "002c47eca011e32b52c71005ad8a8f75e1b44c92c99fd12e43bccfe571e3c2d13d2e9a826a550f5ff63b247af471", "could not decrypt message: failed to decrypt", 1, []interface{}{[]byte("test://TestReadMessage/success-2204f3d89e5a"), nil}, 1, "simple.golden.eml", errors.New("failed to decrypt"), }, {"failed-create-hash", testutil.MustHexDecodeString("500801120f7365637265742d6c6f636174696f6e1a221620aff34d74dcb62c288b1a2f41a4852e82aff6c95e5c40c891299b3488b4340769"), "002c47eca011e32b52c71005ad8a8f75e1b44c92c99fd12e43bccfe571e3c2d13d2e9a826a550f5ff63b247af471", "message-hash invalid", 1, []interface{}{[]byte("test://TestReadMessage/success-2204f3d89e5a"), nil}, 1, "alternative.golden.eml", nil, }, {"success", testutil.MustHexDecodeString("500801120f7365637265742d6c6f636174696f6e1a221620aff34d74dcb62c288b1a2f41a4852e82aff6c95e5c40c891299b3488b4340769"), "002c47eca011e32b52c71005ad8a8f75e1b44c92c99fd12e43bccfe571e3c2d13d2e9a826a550f5ff63b247af471", "", 1, []interface{}{[]byte("test://TestReadMessage/success-2204f3d89e5a"), nil}, 1, "simple.golden.eml", nil, }, } for _, tc := range cases { t.Run(tc.name, func(t *testing.T) { decrypter := ciphertest.NewMockDecrypter(mockCtrl) decrypter.EXPECT().Decrypt(gomock.Any()).Return(tc.decrypterLocationRet...).Times(tc.decrypterLocationCalls) decrypted, _ := ioutil.ReadFile("./testdata/" + tc.decrypterFile) decrypter.EXPECT().Decrypt(gomock.Any()).Return(decrypted, tc.decrypterContentsError).Times(tc.decrypterContentsCalls) actual, err := mailbox.ReadMessage(tc.txData, decrypter) _ = actual if tc.err == "" { assert.NoError(err) assert.Equal(tc.expectedID, actual.ID.HexString()) } if tc.err != "" { assert.EqualError(err, tc.err) } }) } }
explode_data.jsonl/14198
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 1974 }
[ 2830, 3393, 4418, 2052, 1155, 353, 8840, 836, 8, 341, 77333, 15001, 1669, 342, 316, 1176, 7121, 2051, 1155, 340, 16867, 7860, 15001, 991, 18176, 2822, 6948, 1669, 2060, 7121, 1155, 340, 1444, 2264, 1669, 3056, 1235, 341, 197, 11609, 429...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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 TestClient_Put(t *testing.T) { if !isTestManual { t.Skipf("%s not set", envNameTestManual) } err := testClient.Put("testdata/id_ed25519.pub", "/tmp/id_ed25519.pub") if err != nil { t.Fatal(err) } }
explode_data.jsonl/66415
{ "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, 2959, 1088, 332, 1155, 353, 8840, 836, 8, 341, 743, 753, 285, 2271, 52092, 341, 197, 3244, 57776, 69, 4430, 82, 537, 738, 497, 6105, 675, 2271, 52092, 340, 197, 630, 9859, 1669, 1273, 2959, 39825, 445, 92425, 38146, 32370,...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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 TestAddNodeIDToDimensionReturnsInternalError(t *testing.T) { t.Parallel() Convey("Given an internal error is returned from mongo, then response returns an internal error", t, func() { r, err := createRequestWithToken("PUT", "http://localhost:21800/instances/123/dimensions/age/options/55/node_id/11", nil) So(err, ShouldBeNil) w := httptest.NewRecorder() mockedDataStore := &storetest.StorerMock{ GetInstanceFunc: func(ctx context.Context, ID string, eTagSelector string) (*models.Instance, error) { return nil, errs.ErrInternalServer }, } datasetAPI := getAPIWithCMDMocks(testContext, mockedDataStore, &mocks.DownloadsGeneratorMock{}) datasetAPI.Router.ServeHTTP(w, r) So(w.Code, ShouldEqual, http.StatusInternalServerError) So(mockedDataStore.GetInstanceCalls(), ShouldHaveLength, 1) }) Convey("Given instance state is invalid, then response returns an internal error", t, func() { r, err := createRequestWithToken("PUT", "http://localhost:21800/instances/123/dimensions/age/options/55/node_id/11", nil) So(err, ShouldBeNil) w := httptest.NewRecorder() mockedDataStore := &storetest.StorerMock{ GetInstanceFunc: func(ctx context.Context, ID string, eTagSelector string) (*models.Instance, error) { return &models.Instance{State: "gobbledygook"}, nil }, } datasetAPI := getAPIWithCMDMocks(testContext, mockedDataStore, &mocks.DownloadsGeneratorMock{}) datasetAPI.Router.ServeHTTP(w, r) So(w.Code, ShouldEqual, http.StatusInternalServerError) // Gets called twice as there is a check wrapper around this route which // checks the instance is not published before entering handler So(mockedDataStore.GetInstanceCalls(), ShouldHaveLength, 1) }) }
explode_data.jsonl/20828
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 595 }
[ 2830, 3393, 2212, 1955, 915, 1249, 26121, 16446, 11569, 1454, 1155, 353, 8840, 836, 8, 341, 3244, 41288, 7957, 741, 93070, 5617, 445, 22043, 458, 5306, 1465, 374, 5927, 504, 33814, 11, 1221, 2033, 4675, 458, 5306, 1465, 497, 259, 11, ...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
1
func Test_ReplicaSetImages(t *testing.T) { rs := appsv1.ReplicaSet{ Spec: appsv1.ReplicaSetSpec{ Template: v1.PodTemplateSpec{ Spec: v1.PodSpec{ InitContainers: []v1.Container{ { Image: "image1", }, { Image: "image2", }, }, Containers: []v1.Container{ { Image: "image3", }, }, }, }, }, } expected := []string{"image1", "image2", "image3"} actual := ReplicaSetImages(rs) testutil.CheckErrorAndDeepEqual(t, false, nil, expected, actual) }
explode_data.jsonl/54173
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 273 }
[ 2830, 3393, 62, 18327, 15317, 1649, 14228, 1155, 353, 8840, 836, 8, 341, 41231, 1669, 906, 3492, 16, 2817, 79, 15317, 1649, 515, 197, 7568, 992, 25, 906, 3492, 16, 2817, 79, 15317, 1649, 8327, 515, 298, 197, 7275, 25, 348, 16, 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...
1
func TestPrintDefaults(t *testing.T) { fs := NewFlagSet("print defaults test", ContinueOnError) var buf bytes.Buffer fs.SetOutput(&buf) fs.Bool("A", false, "for bootstrapping, allow 'any' type") fs.Bool("Alongflagname", false, "disable bounds checking") fs.Bool("C", true, "a boolean defaulting to true") fs.String("D", "", "set relative `path` for local imports") fs.Float64("F", 2.7, "a non-zero `number`") fs.Float64("G", 0, "a float that defaults to zero") fs.Int("N", 27, "a non-zero int") fs.Int("Z", 0, "an int that defaults to zero") fs.Duration("maxT", 0, "set `timeout` for dial") fs.PrintDefaults() got := buf.String() if got != defaultOutput { t.Errorf("got %q want %q\n", got, defaultOutput) } }
explode_data.jsonl/53999
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 271 }
[ 2830, 3393, 8994, 16273, 1155, 353, 8840, 836, 8, 341, 53584, 1669, 1532, 12135, 1649, 445, 1350, 16674, 1273, 497, 15003, 74945, 340, 2405, 6607, 5820, 22622, 198, 53584, 4202, 5097, 2099, 5909, 340, 53584, 52497, 445, 32, 497, 895, 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 TestTriggerValidation(t *testing.T) { tests := []struct { name string t *Trigger want *apis.FieldError }{{ name: "invalid trigger spec", t: &Trigger{Spec: TriggerSpec{}}, want: &apis.FieldError{ Paths: []string{"spec.broker", "spec.filter", "spec.subscriber"}, Message: "missing field(s)", }, }, { name: "invalid dependency annotation, not a corev1.ObjectReference", t: &Trigger{ ObjectMeta: v1.ObjectMeta{ Annotations: map[string]string{ DependencyAnnotation: invalidDependencyAnnotation, }}, Spec: TriggerSpec{ Broker: "test_broker", Filter: validEmptyFilter, Subscriber: validSubscriber, }}, want: &apis.FieldError{ Paths: []string{dependencyAnnotationPath}, Message: "The provided annotation was not a corev1.ObjectReference: \"invalid dependency annotation\"", Details: "invalid character 'i' looking for beginning of value", }, }, { name: "invalid dependency annotation, trigger namespace is not equal to dependency namespace)", t: &Trigger{ ObjectMeta: v1.ObjectMeta{ Namespace: "test-ns-1", Annotations: map[string]string{ DependencyAnnotation: "{\"kind\":\"CronJobSource\",\"namespace\":\"test-ns-2\", \"name\":\"test-cronjob-source\",\"apiVersion\":\"sources.eventing.knative.dev/v1alpha1\"}", }}, Spec: TriggerSpec{ Broker: "test_broker", Filter: validEmptyFilter, Subscriber: validSubscriber, }}, want: &apis.FieldError{ Paths: []string{dependencyAnnotationPath + "." + "namespace"}, Message: "Namespace must be empty or equal to the trigger namespace \"test-ns-1\"", }, }, { name: "invalid dependency annotation, missing kind)", t: &Trigger{ ObjectMeta: v1.ObjectMeta{ Namespace: "test-ns", Annotations: map[string]string{ DependencyAnnotation: "{\"name\":\"test-cronjob-source\",\"apiVersion\":\"sources.eventing.knative.dev/v1alpha1\"}", }}, Spec: TriggerSpec{ Broker: "test_broker", Filter: validEmptyFilter, Subscriber: validSubscriber, }}, want: &apis.FieldError{ Paths: []string{dependencyAnnotationPath + "." + "kind"}, Message: "missing field(s)", }, }, { name: "invalid dependency annotation, missing name", t: &Trigger{ ObjectMeta: v1.ObjectMeta{ Namespace: "test-ns", Annotations: map[string]string{ DependencyAnnotation: "{\"kind\":\"CronJobSource\",\"apiVersion\":\"sources.eventing.knative.dev/v1alpha1\"}", }}, Spec: TriggerSpec{ Broker: "test_broker", Filter: validEmptyFilter, Subscriber: validSubscriber, }}, want: &apis.FieldError{ Paths: []string{dependencyAnnotationPath + "." + "name"}, Message: "missing field(s)", }, }, { name: "invalid dependency annotation, missing apiVersion", t: &Trigger{ ObjectMeta: v1.ObjectMeta{ Namespace: "test-ns", Annotations: map[string]string{ DependencyAnnotation: "{\"kind\":\"CronJobSource\",\"name\":\"test-cronjob-source\"}", }}, Spec: TriggerSpec{ Broker: "test_broker", Filter: validEmptyFilter, Subscriber: validSubscriber, }}, want: &apis.FieldError{ Paths: []string{dependencyAnnotationPath + "." + "apiVersion"}, Message: "missing field(s)", }, }, { name: "invalid dependency annotation, missing kind, name, apiVersion", t: &Trigger{ ObjectMeta: v1.ObjectMeta{ Namespace: "test-ns", Annotations: map[string]string{ DependencyAnnotation: "{}", }}, Spec: TriggerSpec{ Broker: "test_broker", Filter: validEmptyFilter, Subscriber: validSubscriber, }}, want: &apis.FieldError{ Paths: []string{ dependencyAnnotationPath + "." + "kind", dependencyAnnotationPath + "." + "name", dependencyAnnotationPath + "." + "apiVersion"}, Message: "missing field(s)", }, }, { name: "invalid trigger spec, invalid dependency annotation(missing kind, name, apiVersion)", t: &Trigger{ ObjectMeta: v1.ObjectMeta{ Namespace: "test-ns", Annotations: map[string]string{ DependencyAnnotation: "{}", }}, Spec: TriggerSpec{}}, want: &apis.FieldError{ Paths: []string{ "spec.broker", "spec.filter", "spec.subscriber", dependencyAnnotationPath + "." + "kind", dependencyAnnotationPath + "." + "name", dependencyAnnotationPath + "." + "apiVersion"}, Message: "missing field(s)", }, }, { name: "invalid injection annotation value", t: &Trigger{ ObjectMeta: v1.ObjectMeta{ Namespace: "test-ns", Annotations: map[string]string{ InjectionAnnotation: invalidInjectionAnnotation, }}, Spec: TriggerSpec{ Broker: "default", Filter: validEmptyFilter, Subscriber: validSubscriber, }}, want: &apis.FieldError{ Paths: []string{injectionAnnotationPath}, Message: "The provided injection annotation value can only be \"enabled\", not \"disabled\"", }, }, { name: "valid injection annotation value, non-default broker specified", t: &Trigger{ ObjectMeta: v1.ObjectMeta{ Namespace: "test-ns", Annotations: map[string]string{ InjectionAnnotation: validInjectionAnnotation, }}, Spec: TriggerSpec{ Broker: "test-broker", Filter: validEmptyFilter, Subscriber: validSubscriber, }}, want: &apis.FieldError{ Paths: []string{injectionAnnotationPath}, Message: "The provided injection annotation is only used for default broker, but non-default broker specified here: \"test-broker\"", }, }, } for _, test := range tests { t.Run(test.name, func(t *testing.T) { got := test.t.Validate(context.TODO()) if diff := cmp.Diff(test.want.Error(), got.Error()); diff != "" { t.Errorf("Trigger.Validate (-want, +got) = %v", diff) } }) } }
explode_data.jsonl/76432
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 2478 }
[ 2830, 3393, 17939, 13799, 1155, 353, 8840, 836, 8, 341, 78216, 1669, 3056, 1235, 341, 197, 11609, 914, 198, 197, 3244, 262, 353, 17939, 198, 197, 50780, 353, 13725, 17087, 1454, 198, 197, 15170, 515, 197, 11609, 25, 330, 11808, 8183, ...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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 TestGetFollowAuthParameters(t *testing.T) { t.Run("Valid env value -> error", func(t *testing.T) { restoreEnv := setEnv(t, followAuthPolicyEnvKey, string(acceptListPolicy)) defer restoreEnv() cmd := getTestCmd(t) policy, err := getFollowAuthPolicy(cmd) require.NoError(t, err) require.Equal(t, acceptListPolicy, policy) }) t.Run("Not specified -> default value", func(t *testing.T) { cmd := getTestCmd(t) policy, err := getFollowAuthPolicy(cmd) require.NoError(t, err) require.Equal(t, acceptAllPolicy, policy) }) t.Run("Invalid env value -> error", func(t *testing.T) { restoreEnv := setEnv(t, followAuthPolicyEnvKey, "invalid-policy") defer restoreEnv() cmd := getTestCmd(t) _, err := getFollowAuthPolicy(cmd) require.Error(t, err) require.Contains(t, err.Error(), "unsupported accept/reject authorization type") }) }
explode_data.jsonl/31137
{ "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, 1949, 12480, 5087, 9706, 1155, 353, 8840, 836, 8, 341, 3244, 16708, 445, 4088, 6105, 897, 1464, 1465, 497, 2915, 1155, 353, 8840, 836, 8, 341, 197, 96027, 14359, 1669, 738, 14359, 1155, 11, 1795, 5087, 13825, 14359, 1592, ...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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 TestHasPrefix(t *testing.T) { for _, test := range []struct { prefixes []string path string out bool }{ {[]string{"/ipfs"}, "/ipfs/cid", true}, {[]string{"/ipfs/"}, "/ipfs/cid", true}, {[]string{"/version/"}, "/version", true}, {[]string{"/version"}, "/version", true}, } { out := hasPrefix(test.path, test.prefixes...) if out != test.out { t.Errorf("(%+v, %s) returned '%t', expected '%t'", test.prefixes, test.path, out, test.out) } } }
explode_data.jsonl/26662
{ "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, 10281, 14335, 1155, 353, 8840, 836, 8, 341, 2023, 8358, 1273, 1669, 2088, 3056, 1235, 341, 197, 3223, 5060, 288, 3056, 917, 198, 197, 26781, 257, 914, 198, 197, 13967, 414, 1807, 198, 197, 59403, 197, 197, 90, 1294, 917, ...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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 TestLogoutLogin(t *testing.T) { itest(t, func(ctx context.Context, guest, host *Starlightd) { steps := append(channelCreationSteps(guest, host, 0, 0, channelFundingAmount), logoutSteps(guest, host)...) steps = append(steps, loginSteps(guest, host)...) var channelID string for _, s := range steps { testStep(ctx, t, s, &channelID) } }) }
explode_data.jsonl/26088
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 137 }
[ 2830, 3393, 27958, 6231, 1155, 353, 8840, 836, 8, 341, 23374, 477, 1155, 11, 2915, 7502, 2266, 9328, 11, 8640, 11, 3468, 353, 12699, 4145, 67, 8, 341, 197, 18388, 7124, 1669, 8737, 25923, 32701, 33951, 3268, 3045, 11, 3468, 11, 220, ...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
2
func TestPrivateKeyRead(t *testing.T) { for i, test := range privateKeyTests { packet, err := Read(readerFromHex(test.privateKeyHex)) if err != nil { t.Errorf("#%d: failed to parse: %s", i, err) continue } privKey := packet.(*PrivateKey) if !privKey.Encrypted { t.Errorf("#%d: private key isn't encrypted", i) continue } err = privKey.Decrypt([]byte("wrong password")) if err == nil { t.Errorf("#%d: decrypted with incorrect key", i) continue } err = privKey.Decrypt([]byte("testing")) if err != nil { t.Errorf("#%d: failed to decrypt: %s", i, err) continue } if !privKey.CreationTime.Equal(test.creationTime) || privKey.Encrypted { t.Errorf("#%d: bad result, got: %#v", i, privKey) } } }
explode_data.jsonl/48194
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 317 }
[ 2830, 3393, 75981, 4418, 1155, 353, 8840, 836, 8, 341, 2023, 600, 11, 1273, 1669, 2088, 70565, 18200, 341, 197, 68802, 11, 1848, 1669, 4457, 21987, 3830, 20335, 8623, 61603, 1592, 20335, 1171, 197, 743, 1848, 961, 2092, 341, 298, 3244, ...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
8
func TestMapProxy_AddEntryListenerClear(t *testing.T) { var wg *sync.WaitGroup = new(sync.WaitGroup) entryAdded := &AddEntry{wg: wg} registrationId, err := mp.AddEntryListener(entryAdded, true) AssertEqual(t, err, nil, nil) wg.Add(2) mp.Put("test", "key") mp.Clear() timeout := WaitTimeout(wg, Timeout) AssertEqualf(t, nil, false, timeout, "AddEntryListener entryClear failed") mp.RemoveEntryListener(registrationId) mp.Clear() }
explode_data.jsonl/57032
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 166 }
[ 2830, 3393, 2227, 16219, 21346, 5874, 2743, 14008, 1155, 353, 8840, 836, 8, 1476, 2405, 63581, 353, 12996, 28384, 2808, 284, 501, 97233, 28384, 2808, 340, 48344, 19337, 1669, 609, 2212, 5874, 90, 45540, 25, 63581, 532, 197, 25862, 764, ...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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 TestStructPtrMap(t *testing.T) { m := map[string]*contact{ "bill": &contact{Name: "bill smith"}, "mary": &contact{Name: "mary smith"}, } _, err := starlight.Eval([]byte(`contacts["bill"].Name = "john smith"`), map[string]interface{}{"contacts": m}, nil) if err != nil { t.Fatal(err) } expected := "john smith" if m["bill"].Name != expected { t.Fatalf("expected %q, but was %q", expected, m["bill"].Name) } }
explode_data.jsonl/47075
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 177 }
[ 2830, 3393, 9422, 5348, 2227, 1155, 353, 8840, 836, 8, 341, 2109, 1669, 2415, 14032, 8465, 6287, 515, 197, 197, 1, 29642, 788, 609, 6287, 63121, 25, 330, 29642, 76721, 7115, 197, 197, 1, 1534, 788, 609, 6287, 63121, 25, 330, 1534, 7...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
3
func TestMap(t *testing.T) { type child struct { Body string `json:"the-body"` } type parent struct { Title string `json:"title"` Data Map `json:"data"` } input := &parent{ Title: "foo", Data: MustMap(child{Body: "body"}, JSON), } bytes1, err := json.Marshal(input) assert.NoError(t, err) assert.Equal(t, `{"title":"foo","data":{"the-body":"body"}}`, string(bytes1)) var output1 parent err = json.Unmarshal(bytes1, &output1) assert.NoError(t, err) assert.Equal(t, parent{ Title: "foo", Data: Map{ "the-body": "body", }, }, output1) var ch1 child output1.Data.MustUnmarshal(&ch1, JSON) assert.Equal(t, child{Body: "body"}, ch1) bytes2, err := bson.Marshal(input) assert.NoError(t, err) var output2 parent err = bson.Unmarshal(bytes2, &output2) assert.NoError(t, err) assert.Equal(t, parent{ Title: "foo", Data: Map{ "the-body": "body", }, }, output2) var ch2 child output2.Data.MustUnmarshal(&ch2, JSON) assert.Equal(t, child{Body: "body"}, ch2) }
explode_data.jsonl/10186
{ "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, 2227, 1155, 353, 8840, 836, 8, 341, 13158, 1682, 2036, 341, 197, 197, 5444, 914, 1565, 2236, 2974, 1782, 9350, 8805, 197, 630, 13158, 2681, 2036, 341, 197, 92233, 914, 1565, 2236, 2974, 2102, 8805, 197, 40927, 220, 5027, 2...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
1
func TestDeleteClusterStep_Rollback(t *testing.T) { s := &DeleteClusterStep{} if err := s.Rollback(context.Background(), &bytes.Buffer{}, &steps.Config{}); err != nil { t.Errorf("Unexpected error when rollback %v", err) } }
explode_data.jsonl/30786
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 82 }
[ 2830, 3393, 6435, 28678, 8304, 2568, 965, 1419, 1155, 353, 8840, 836, 8, 341, 1903, 1669, 609, 6435, 28678, 8304, 31483, 743, 1848, 1669, 274, 88918, 5378, 19047, 1507, 609, 9651, 22622, 22655, 609, 24080, 10753, 6257, 1215, 1848, 961, ...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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 TestPIE(t *testing.T) { switch GOOS { case "windows", "darwin", "plan9": t.Skipf("skipping PIE test on %s", GOOS) } defer func() { os.Remove("testp" + exeSuffix) os.RemoveAll("pkg") }() cmd := exec.Command("go", "install", "-i", "-buildmode=c-archive", "libgo") cmd.Env = gopathEnv if out, err := cmd.CombinedOutput(); err != nil { t.Logf("%s", out) t.Fatal(err) } ccArgs := append(cc, "-fPIE", "-pie", "-o", "testp"+exeSuffix, "main.c", "main_unix.c", filepath.Join("pkg", libgodir, "libgo.a")) if out, err := exec.Command(ccArgs[0], ccArgs[1:]...).CombinedOutput(); err != nil { t.Logf("%s", out) t.Fatal(err) } binArgs := append(bin, "arg1", "arg2") if out, err := exec.Command(binArgs[0], binArgs[1:]...).CombinedOutput(); err != nil { t.Logf("%s", out) t.Fatal(err) } f, err := elf.Open("testp" + exeSuffix) if err != nil { t.Fatal("elf.Open failed: ", err) } defer f.Close() if hasDynTag(t, f, elf.DT_TEXTREL) { t.Errorf("%s has DT_TEXTREL flag", "testp"+exeSuffix) } }
explode_data.jsonl/50864
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 472 }
[ 2830, 3393, 1893, 36, 1155, 353, 8840, 836, 8, 341, 8961, 12604, 3126, 341, 2722, 330, 27077, 497, 330, 98765, 497, 330, 10393, 24, 4660, 197, 3244, 57776, 69, 445, 4886, 5654, 79455, 1273, 389, 1018, 82, 497, 12604, 3126, 340, 197, ...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
1
func TestNetworkCreateDuplicatedError(t *testing.T) { client := &APIClient{ HTTPCli: newMockClient(errorMockResponse(http.StatusConflict, "Container already exists")), } _, err := client.NetworkCreate(context.Background(), &types.NetworkCreateConfig{}) if err == nil || strings.Contains(err.Error(), "duplicated container") { t.Fatalf("expected a Container Already Exists Error, got %v", err) } }
explode_data.jsonl/18644
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 131 }
[ 2830, 3393, 12320, 4021, 35, 98984, 1454, 1155, 353, 8840, 836, 8, 341, 25291, 1669, 609, 2537, 98900, 515, 197, 197, 9230, 87014, 25, 501, 11571, 2959, 6390, 11571, 2582, 19886, 10538, 57974, 11, 330, 4502, 2669, 6724, 30154, 197, 532,...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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 TestListEnvironments(t *testing.T) { path := helpers.BuildURL(api.BasePath, api.EnvironmentsPath) t.Run("returns list with one element", func(t *testing.T) { response, err := http.Get(path) //nolint:gosec // because we build this path right above require.NoError(t, err) assert.Equal(t, http.StatusOK, response.StatusCode) environmentsArray := assertEnvironmentArrayInResponse(t, response) assert.Equal(t, 1, len(environmentsArray)) }) t.Run("returns list including the default environment", func(t *testing.T) { response, err := http.Get(path) //nolint:gosec // because we build this path right above require.NoError(t, err) require.Equal(t, http.StatusOK, response.StatusCode) environmentsArray := assertEnvironmentArrayInResponse(t, response) require.Equal(t, 1, len(environmentsArray)) assertEnvironment(t, environmentsArray[0], tests.DefaultEnvironmentIDAsInteger) }) t.Run("Added environments can be retrieved without fetch", func(t *testing.T) { createEnvironment(t, tests.AnotherEnvironmentIDAsString) response, err := http.Get(path) //nolint:gosec // because we build this path right above require.NoError(t, err) require.Equal(t, http.StatusOK, response.StatusCode) environmentsArray := assertEnvironmentArrayInResponse(t, response) require.Equal(t, 2, len(environmentsArray)) foundIDs := parseIDsFromEnvironments(t, environmentsArray) assert.Contains(t, foundIDs, dto.EnvironmentID(tests.AnotherEnvironmentIDAsInteger)) }) deleteEnvironment(t, tests.AnotherEnvironmentIDAsString) t.Run("Added environments can be retrieved with fetch", func(t *testing.T) { // Add environment without Poseidon _, job := helpers.CreateTemplateJob() jobID := nomad.TemplateJobID(tests.AnotherEnvironmentIDAsInteger) job.ID = &jobID job.Name = &jobID _, _, err := nomadClient.Jobs().Register(job, nil) require.NoError(t, err) <-time.After(tests.ShortTimeout) // Nomad needs a bit to create the job // List without fetch should not include the added environment response, err := http.Get(path) //nolint:gosec // because we build this path right above require.NoError(t, err) require.Equal(t, http.StatusOK, response.StatusCode) environmentsArray := assertEnvironmentArrayInResponse(t, response) require.Equal(t, 1, len(environmentsArray)) assertEnvironment(t, environmentsArray[0], tests.DefaultEnvironmentIDAsInteger) // List with fetch should include the added environment response, err = http.Get(path + "?fetch=true") //nolint:gosec // because we build this path right above require.NoError(t, err) require.Equal(t, http.StatusOK, response.StatusCode) environmentsArray = assertEnvironmentArrayInResponse(t, response) require.Equal(t, 2, len(environmentsArray)) foundIDs := parseIDsFromEnvironments(t, environmentsArray) assert.Contains(t, foundIDs, dto.EnvironmentID(tests.AnotherEnvironmentIDAsInteger)) }) deleteEnvironment(t, tests.AnotherEnvironmentIDAsString) }
explode_data.jsonl/62913
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 947 }
[ 2830, 3393, 852, 1702, 17866, 1155, 353, 8840, 836, 8, 341, 26781, 1669, 30187, 25212, 3144, 24827, 13018, 1820, 11, 6330, 22834, 17866, 1820, 692, 3244, 16708, 445, 4216, 1140, 448, 825, 2392, 497, 2915, 1155, 353, 8840, 836, 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 TestNewConfigAwsRegionWarning(t *testing.T) { testCases := []struct { environment map[string]interface{} expectedType string expectedLog string }{ { // this test issues a warning for missing AWS_REGION env var map[string]interface{}{ "AVP_TYPE": "awssecretsmanager", "AWS_ACCESS_KEY_ID": "id", "AWS_SECRET_ACCESS_KEY": "key", }, "*backends.AWSSecretsManager", "Warning: AWS_REGION env var not set, using AWS region us-east-2.\n", }, { // no warning is issued map[string]interface{}{ "AVP_TYPE": "awssecretsmanager", "AWS_REGION": "us-west-1", "AWS_ACCESS_KEY_ID": "id", "AWS_SECRET_ACCESS_KEY": "key", }, "*backends.AWSSecretsManager", "", }, } for _, tc := range testCases { for k, v := range tc.environment { os.Setenv(k, v.(string)) } viper := viper.New() output := captureOutput(func() { config, err := config.New(viper, &config.Options{}) if err != nil { t.Error(err) t.FailNow() } xType := fmt.Sprintf("%T", config.Backend) if xType != tc.expectedType { t.Errorf("expected: %s, got: %s.", tc.expectedType, xType) } }) if output != tc.expectedLog { t.Errorf("Unexpected warning issued. Expected: %s, actual: %s", tc.expectedLog, output) } for k := range tc.environment { os.Unsetenv(k) } } }
explode_data.jsonl/54094
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 634 }
[ 2830, 3393, 3564, 2648, 47359, 14091, 12087, 1155, 353, 8840, 836, 8, 341, 18185, 37302, 1669, 3056, 1235, 341, 197, 197, 23294, 220, 2415, 14032, 31344, 16094, 197, 42400, 929, 914, 198, 197, 42400, 2201, 220, 914, 198, 197, 59403, 197...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
3
func TestGet(t *testing.T) { p := New() p.Set("foo", "bar") assert.Equal(t, "bar", p.Get("foo")) p.Set("foo2", "b", "a", "r") assert.Equal(t, "", p.Get("foo2")) }
explode_data.jsonl/1460
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 84 }
[ 2830, 3393, 1949, 1155, 353, 8840, 836, 8, 341, 3223, 1669, 1532, 741, 3223, 4202, 445, 7975, 497, 330, 2257, 1138, 6948, 12808, 1155, 11, 330, 2257, 497, 281, 2234, 445, 7975, 28075, 3223, 4202, 445, 7975, 17, 497, 330, 65, 497, 33...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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 TestDeleteWithSomeMissingJobs(t *testing.T) { withRepository(func(r *RedisJobRepository) { missingJob := &api.Job{Id: "jobId"} runningJob := addLeasedJob(t, r, "queue1", "cluster1") result, err := r.DeleteJobs([]*api.Job{missingJob, runningJob}) if err != nil { t.Fatalf("deleting jobs failed with error %s", err) } err, deletionOccurred := result[missingJob] assert.Nil(t, err) assert.False(t, deletionOccurred) err, deletionOccurred = result[runningJob] assert.Nil(t, err) assert.True(t, deletionOccurred) }) }
explode_data.jsonl/32050
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 215 }
[ 2830, 3393, 6435, 2354, 8373, 25080, 40667, 1155, 353, 8840, 836, 8, 341, 46948, 4624, 18552, 2601, 353, 48137, 12245, 4624, 8, 341, 197, 197, 30616, 12245, 1669, 609, 2068, 45293, 90, 764, 25, 330, 8799, 764, 16707, 197, 197, 27173, ...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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 TestMatch_Or(t *testing.T) { var testData = []struct { rawYql string data map[string]interface{} out bool }{ { rawYql: `a=10 or b>'2'`, data: map[string]interface{}{ "a": int64(10), "b": int64(1), }, out: true, }, { rawYql: `a=10 or b>'2'`, data: map[string]interface{}{ "a": int64(9), "b": int64(2), }, out: false, }, { rawYql: `a=10 or b>'2'`, data: map[string]interface{}{ "a": int64(10), "b": int64(3), }, out: true, }, { rawYql: `a=10 or b>'2' or c<9`, data: map[string]interface{}{ "a": int64(1), "b": int64(3), "c": int64(100), }, out: true, }, { rawYql: `a=10 or b>'2' or c<9 or d!=2`, data: map[string]interface{}{ "a": int64(1), "b": int64(2), "c": int64(10), "d": int64(0), }, out: true, }, { rawYql: `a=10 or b>'2' or c<9 or d!=2`, data: map[string]interface{}{ "a": int64(1), "b": int64(1), "c": int64(10), "d": int64(2), }, out: false, }, } ass := assert.New(t) for _, tc := range testData { ok, err := Match(tc.rawYql, tc.data) ass.NoError(err) ass.Equal(tc.out, ok, "rawYql=%s||data=%+v", tc.rawYql, tc.data) } }
explode_data.jsonl/65942
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 710 }
[ 2830, 3393, 8331, 62, 2195, 1155, 353, 8840, 836, 8, 341, 2405, 67348, 284, 3056, 1235, 341, 197, 76559, 56, 1470, 914, 198, 197, 8924, 256, 2415, 14032, 31344, 16094, 197, 13967, 262, 1807, 198, 197, 59403, 197, 197, 515, 298, 76559,...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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 TestSokuonG(t *testing.T) { const want = "ggaggigguggeggo" for _, v := range []string{"っがっぎっぐっげっご", "ッガッギッグッゲッゴ"} { got, err := KanaToRomaji(v) assert.Equal(t, want, got) assert.Nil(t, err) } }
explode_data.jsonl/11344
{ "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, 50, 16493, 263, 38, 1155, 353, 8840, 836, 8, 341, 4777, 1366, 284, 330, 14398, 15718, 20218, 768, 709, 70, 3346, 1837, 2023, 8358, 348, 1669, 2088, 3056, 917, 4913, 41791, 28195, 41791, 124902, 41791, 125161, 41791, 124682, ...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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 TestDefaultComponents(t *testing.T) { expectedExtensions := []configmodels.Type{ "health_check", "pprof", "zpages", "fluentbit", } expectedReceivers := []configmodels.Type{ "jaeger", "zipkin", "prometheus", "opencensus", "otlp", "hostmetrics", "fluentforward", } expectedProcessors := []configmodels.Type{ "attributes", "resource", "queued_retry", "batch", "memory_limiter", "tail_sampling", "probabilistic_sampler", "span", "filter", } expectedExporters := []configmodels.Type{ "opencensus", "prometheus", "logging", "zipkin", "jaeger", "file", "otlp", "kafka", } factories, err := Components() assert.NoError(t, err) exts := factories.Extensions assert.Equal(t, len(expectedExtensions), len(exts)) for _, k := range expectedExtensions { v, ok := exts[k] assert.True(t, ok) assert.Equal(t, k, v.Type()) } recvs := factories.Receivers assert.Equal(t, len(expectedReceivers), len(recvs)) for _, k := range expectedReceivers { v, ok := recvs[k] require.True(t, ok) assert.Equal(t, k, v.Type()) } procs := factories.Processors assert.Equal(t, len(expectedProcessors), len(procs)) for _, k := range expectedProcessors { v, ok := procs[k] require.True(t, ok) assert.Equal(t, k, v.Type()) } exps := factories.Exporters assert.Equal(t, len(expectedExporters), len(exps)) for _, k := range expectedExporters { v, ok := exps[k] require.True(t, ok) assert.Equal(t, k, v.Type()) } }
explode_data.jsonl/39331
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 648 }
[ 2830, 3393, 3675, 10443, 1155, 353, 8840, 836, 8, 341, 42400, 31282, 1669, 3056, 1676, 6507, 10184, 515, 197, 197, 1, 12120, 7200, 756, 197, 197, 1, 602, 299, 69, 756, 197, 197, 1, 89, 10781, 756, 197, 197, 1, 1489, 11680, 4489, 7...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
5
func TestCatalog_Register_FailedCase1(t *testing.T) { t.Parallel() dir1, s1 := testServer(t) defer os.RemoveAll(dir1) defer s1.Shutdown() codec := rpcClient(t, s1) defer codec.Close() arg := structs.RegisterRequest{ Datacenter: "dc1", Node: "bar", Address: "127.0.0.2", Service: &structs.NodeService{ Service: "web", Tags: nil, Port: 8000, }, } var out struct{} err := msgpackrpc.CallWithCodec(codec, "Catalog.Register", &arg, &out) if err != nil { t.Fatalf("err: %v", err) } testrpc.WaitForLeader(t, s1.RPC, "dc1") if err := msgpackrpc.CallWithCodec(codec, "Catalog.Register", &arg, &out); err != nil { t.Fatalf("err: %v", err) } // Check we can get this back query := &structs.ServiceSpecificRequest{ Datacenter: "dc1", ServiceName: "web", } var out2 structs.IndexedServiceNodes if err := msgpackrpc.CallWithCodec(codec, "Catalog.ServiceNodes", query, &out2); err != nil { t.Fatalf("err: %v", err) } // Check the output if len(out2.ServiceNodes) != 1 { t.Fatalf("Bad: %v", out2) } }
explode_data.jsonl/49244
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 470 }
[ 2830, 3393, 41606, 73124, 1400, 5687, 4207, 16, 1155, 353, 8840, 836, 8, 341, 3244, 41288, 7957, 741, 48532, 16, 11, 274, 16, 1669, 1273, 5475, 1155, 340, 16867, 2643, 84427, 14161, 16, 340, 16867, 274, 16, 10849, 18452, 741, 43343, 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...
5
func TestContextRenderNoContentIndentedJSON(t *testing.T) { w := httptest.NewRecorder() c, _ := CreateTestContext(w) c.IndentedJSON(http.StatusNoContent, H{"foo": "bar", "bar": "foo", "nested": H{"foo": "bar"}}) assert.Equal(t, http.StatusNoContent, w.Code) assert.Empty(t, w.Body.String()) assert.Equal(t, "application/json; charset=utf-8", w.Header().Get("Content-Type")) }
explode_data.jsonl/26776
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 147 }
[ 2830, 3393, 1972, 6750, 2753, 2762, 89509, 5370, 1155, 353, 8840, 836, 8, 341, 6692, 1669, 54320, 70334, 7121, 47023, 741, 1444, 11, 716, 1669, 4230, 2271, 1972, 3622, 692, 1444, 13, 89509, 5370, 19886, 10538, 2753, 2762, 11, 472, 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 TestWSHandshakeTimeout(t *testing.T) { o := testWSOptions() o.Websocket.HandshakeTimeout = time.Millisecond tc := &TLSConfigOpts{ CertFile: "./configs/certs/server.pem", KeyFile: "./configs/certs/key.pem", } o.Websocket.TLSConfig, _ = GenTLSConfig(tc) s := RunServer(o) defer s.Shutdown() logger := &captureErrorLogger{errCh: make(chan string, 1)} s.SetLogger(logger, false, false) addr := fmt.Sprintf("%s:%d", o.Websocket.Host, o.Websocket.Port) wsc, err := net.Dial("tcp", addr) if err != nil { t.Fatalf("Error creating ws connection: %v", err) } defer wsc.Close() // Delay the handshake wsc = tls.Client(wsc, &tls.Config{InsecureSkipVerify: true}) time.Sleep(20 * time.Millisecond) // We expect error since the server should have cut us off if err := wsc.(*tls.Conn).Handshake(); err == nil { t.Fatal("Expected error during handshake") } // Check that server logs error select { case e := <-logger.errCh: if !strings.Contains(e, "timeout") { t.Fatalf("Unexpected error: %v", e) } case <-time.After(time.Second): t.Fatalf("Should have timed-out") } }
explode_data.jsonl/42718
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 447 }
[ 2830, 3393, 7433, 2314, 29661, 7636, 1155, 353, 8840, 836, 8, 341, 22229, 1669, 1273, 7433, 3798, 741, 22229, 6473, 9556, 35308, 29661, 7636, 284, 882, 71482, 198, 78255, 1669, 609, 45439, 2648, 43451, 515, 197, 6258, 529, 1703, 25, 592...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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 TestAlphaLocalStorageCapacityIsolation(t *testing.T) { testCases := []core.VolumeSource{ {EmptyDir: &core.EmptyDirVolumeSource{SizeLimit: resource.NewQuantity(int64(5), resource.BinarySI)}}, } for _, tc := range testCases { if errs := validateVolumeSource(&tc, field.NewPath("spec"), "tmpvol"); len(errs) != 0 { t.Errorf("expected success: %v", errs) } } containerLimitCase := core.ResourceRequirements{ Limits: core.ResourceList{ core.ResourceEphemeralStorage: *resource.NewMilliQuantity( int64(40000), resource.BinarySI), }, } if errs := ValidateResourceRequirements(&containerLimitCase, field.NewPath("resources")); len(errs) != 0 { t.Errorf("expected success: %v", errs) } }
explode_data.jsonl/25635
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 260 }
[ 2830, 3393, 19384, 90464, 29392, 3872, 34962, 1155, 353, 8840, 836, 8, 1476, 18185, 37302, 1669, 3056, 2153, 79106, 3608, 515, 197, 197, 90, 3522, 6184, 25, 609, 2153, 11180, 6184, 18902, 3608, 90, 1695, 16527, 25, 5101, 7121, 17342, 15...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
4
func TestJetStream_Drain(t *testing.T) { s := RunBasicJetStreamServer() defer s.Shutdown() if config := s.JetStreamConfig(); config != nil { defer os.RemoveAll(config.StoreDir) } ctx, done := context.WithTimeout(context.Background(), 10*time.Second) nc, err := nats.Connect(s.ClientURL(), nats.ClosedHandler(func(_ *nats.Conn) { done() })) if err != nil { t.Fatalf("Unexpected error: %v", err) } defer nc.Close() js, err := nc.JetStream(nats.MaxWait(250 * time.Millisecond)) if err != nil { t.Fatalf("Unexpected error: %v", err) } _, err = js.AddStream(&nats.StreamConfig{ Name: "TEST", Subjects: []string{"drain"}, }) if err != nil { t.Fatalf("Unexpected error: %v", err) } total := 500 for i := 0; i < total; i++ { _, err := js.Publish("drain", []byte(fmt.Sprintf("i:%d", i))) if err != nil { t.Error(err) } } // Create some consumers and ensure that there are no timeouts. errCh := make(chan error, 2048) createSub := func(name string) (*nats.Subscription, error) { return js.Subscribe("drain", func(m *nats.Msg) { err := m.AckSync() if err != nil { errCh <- err } }, nats.Durable(name), nats.ManualAck()) } subA, err := createSub("A") if err != nil { t.Fatalf("Unexpected error: %v", err) } subB, err := createSub("B") if err != nil { t.Fatalf("Unexpected error: %v", err) } subC, err := createSub("C") if err != nil { t.Fatalf("Unexpected error: %v", err) } subD, err := createSub("D") if err != nil { t.Fatalf("Unexpected error: %v", err) } waitForDelivered := func(t *testing.T, sub *nats.Subscription) { t.Helper() timeout := time.Now().Add(2 * time.Second) for time.Now().Before(timeout) { if msgs, _ := sub.Delivered(); msgs != 0 { return } time.Sleep(10 * time.Millisecond) } } waitForDelivered(t, subA) waitForDelivered(t, subB) waitForDelivered(t, subC) waitForDelivered(t, subD) nc.Drain() select { case err := <-errCh: t.Fatalf("Error during drain: %+v", err) case <-ctx.Done(): // OK! } }
explode_data.jsonl/29160
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 867 }
[ 2830, 3393, 35641, 3027, 1557, 29093, 1155, 353, 8840, 836, 8, 341, 1903, 1669, 6452, 15944, 35641, 3027, 5475, 741, 16867, 274, 10849, 18452, 2822, 743, 2193, 1669, 274, 3503, 295, 3027, 2648, 2129, 2193, 961, 2092, 341, 197, 16867, 26...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
1
func TestEcPointAddCommunicative(t *testing.T) { curve := btcec.S256() a, _ := core.Rand(curve.Params().N) b, _ := core.Rand(curve.Params().N) p1, _ := NewScalarBaseMult(curve, a) p2, _ := NewScalarBaseMult(curve, b) p3, err := p1.Add(p2) if err != nil { t.Errorf("EcPoint.Add failed: %v", err) } p4, err := p2.Add(p1) if err != nil { t.Errorf("EcPoint.Add failed: %v", err) } if !bytes.Equal(p3.Bytes(), p4.Bytes()) { t.Errorf("EcPoint.Add Communicative not valid") } }
explode_data.jsonl/75665
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 232 }
[ 2830, 3393, 50730, 2609, 2212, 80923, 1388, 1155, 353, 8840, 836, 8, 341, 33209, 586, 1669, 19592, 68955, 808, 17, 20, 21, 741, 11323, 11, 716, 1669, 6200, 2013, 437, 17591, 586, 58268, 1005, 45, 340, 2233, 11, 716, 1669, 6200, 2013, ...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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 TestU8_Hash(t *testing.T) { assertHash(t, []hashAssert{ {NewU8(29), MustHexDecodeString("0x6a9843ae0195ae1e6f95c7fbd34a42414c77e243aa18a959b5912a1f0f391b54")}, }) }
explode_data.jsonl/18387
{ "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, 52, 23, 2039, 988, 1155, 353, 8840, 836, 8, 341, 6948, 6370, 1155, 11, 3056, 8296, 8534, 515, 197, 197, 90, 3564, 52, 23, 7, 17, 24, 701, 15465, 20335, 32564, 703, 445, 15, 87, 21, 64, 24, 23, 19, 18, 5918, 15, 16,...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
1
func TestCrossStructLtFieldValidation(t *testing.T) { type Inner struct { CreatedAt *time.Time String string Int int Uint uint Float float64 Array []string } type Test struct { Inner *Inner CreatedAt *time.Time `validate:"ltcsfield=Inner.CreatedAt"` String string `validate:"ltcsfield=Inner.String"` Int int `validate:"ltcsfield=Inner.Int"` Uint uint `validate:"ltcsfield=Inner.Uint"` Float float64 `validate:"ltcsfield=Inner.Float"` Array []string `validate:"ltcsfield=Inner.Array"` } now := time.Now().UTC() then := now.Add(time.Hour * 5) inner := &Inner{ CreatedAt: &then, String: "abcd", Int: 13, Uint: 13, Float: 1.13, Array: []string{"val1", "val2"}, } test := &Test{ Inner: inner, CreatedAt: &now, String: "abc", Int: 12, Uint: 12, Float: 1.12, Array: []string{"val1"}, } validate := New() errs := validate.Struct(test) Equal(t, errs, nil) test.CreatedAt = &then test.String = "abcd" test.Int = 13 test.Uint = 13 test.Float = 1.13 test.Array = []string{"val1", "val2"} errs = validate.Struct(test) NotEqual(t, errs, nil) AssertError(t, errs, "Test.CreatedAt", "Test.CreatedAt", "CreatedAt", "CreatedAt", "ltcsfield") AssertError(t, errs, "Test.String", "Test.String", "String", "String", "ltcsfield") AssertError(t, errs, "Test.Int", "Test.Int", "Int", "Int", "ltcsfield") AssertError(t, errs, "Test.Uint", "Test.Uint", "Uint", "Uint", "ltcsfield") AssertError(t, errs, "Test.Float", "Test.Float", "Float", "Float", "ltcsfield") AssertError(t, errs, "Test.Array", "Test.Array", "Array", "Array", "ltcsfield") errs = validate.VarWithValue(1, "", "ltcsfield") NotEqual(t, errs, nil) AssertError(t, errs, "", "", "", "", "ltcsfield") // this test is for the WARNING about unforeseen validation issues. errs = validate.VarWithValue(test, now, "ltcsfield") NotEqual(t, errs, nil) AssertError(t, errs, "Test.CreatedAt", "Test.CreatedAt", "CreatedAt", "CreatedAt", "ltcsfield") AssertError(t, errs, "Test.String", "Test.String", "String", "String", "ltcsfield") AssertError(t, errs, "Test.Int", "Test.Int", "Int", "Int", "ltcsfield") AssertError(t, errs, "Test.Uint", "Test.Uint", "Uint", "Uint", "ltcsfield") AssertError(t, errs, "Test.Float", "Test.Float", "Float", "Float", "ltcsfield") AssertError(t, errs, "Test.Array", "Test.Array", "Array", "Array", "ltcsfield") type Other struct { Value string } type Test2 struct { Value Other Time time.Time `validate:"ltcsfield=Value"` } tst := Test2{ Value: Other{Value: "StringVal"}, Time: then, } errs = validate.Struct(tst) NotEqual(t, errs, nil) AssertError(t, errs, "Test2.Time", "Test2.Time", "Time", "Time", "ltcsfield") }
explode_data.jsonl/77226
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 1240 }
[ 2830, 3393, 28501, 9422, 87660, 1877, 13799, 1155, 353, 8840, 836, 8, 1476, 13158, 36356, 2036, 341, 197, 84062, 1655, 353, 1678, 16299, 198, 197, 4980, 262, 914, 198, 197, 57152, 981, 526, 198, 197, 15980, 396, 414, 2622, 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, 1...
1
func Test_Monitor_JSON(t *testing.T) { t.Parallel() app := fiber.New() app.Get("/", New()) req := httptest.NewRequest(fiber.MethodGet, "/", nil) req.Header.Set(fiber.HeaderAccept, fiber.MIMEApplicationJSON) resp, err := app.Test(req) utils.AssertEqual(t, nil, err) utils.AssertEqual(t, 200, resp.StatusCode) utils.AssertEqual(t, fiber.MIMEApplicationJSON, resp.Header.Get(fiber.HeaderContentType)) b, err := ioutil.ReadAll(resp.Body) utils.AssertEqual(t, nil, err) utils.AssertEqual(t, true, bytes.Contains(b, []byte("pid"))) utils.AssertEqual(t, true, bytes.Contains(b, []byte("os"))) }
explode_data.jsonl/23612
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 243 }
[ 2830, 3393, 1245, 30314, 25356, 1155, 353, 8840, 836, 8, 341, 3244, 41288, 7957, 2822, 28236, 1669, 23788, 7121, 2822, 28236, 2234, 35460, 1532, 12367, 24395, 1669, 54320, 70334, 75274, 955, 8629, 20798, 1949, 11, 64657, 2092, 340, 24395, ...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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 TestAuthorizeWithLocksForBuiltinRole(t *testing.T) { t.Parallel() ctx := context.Background() srv, err := NewTestAuthServer(TestAuthServerConfig{ Dir: t.TempDir(), Clock: clockwork.NewFakeClock(), }) require.NoError(t, err) builtinRole := BuiltinRole{ Username: "node", Role: types.RoleNode, Identity: tlsca.Identity{ Username: "node", }, } // Apply a node lock. nodeLock, err := types.NewLock("node-lock", types.LockSpecV2{ Target: types.LockTarget{Node: builtinRole.Identity.Username}, }) require.NoError(t, err) upsertLockWithPutEvent(ctx, t, srv, nodeLock) _, err = srv.Authorizer.Authorize(context.WithValue(ctx, ContextUser, builtinRole)) require.Error(t, err) require.True(t, trace.IsAccessDenied(err)) builtinRole.Identity.Username = "" _, err = srv.Authorizer.Authorize(context.WithValue(ctx, ContextUser, builtinRole)) require.NoError(t, err) }
explode_data.jsonl/10804
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 350 }
[ 2830, 3393, 37483, 2354, 11989, 82, 2461, 33, 25628, 9030, 1155, 353, 8840, 836, 8, 341, 3244, 41288, 7957, 741, 20985, 1669, 2266, 19047, 2822, 1903, 10553, 11, 1848, 1669, 1532, 2271, 5087, 5475, 31159, 5087, 5475, 2648, 515, 197, 197...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
1
func TestWebConnectivityRunnerWithMaybeLookupBackendsFailure(t *testing.T) { errMocked := errors.New("mocked error") sess := &FakeExperimentSession{ LockCount: &atomicx.Int64{}, LookupBackendsErr: errMocked, UnlockCount: &atomicx.Int64{}, } runner := &webConnectivityRunner{sess: sess} ctx := context.Background() config := &WebConnectivityConfig{Input: "https://ooni.org"} out, err := runner.run(ctx, config) if !errors.Is(err, errMocked) { t.Fatal("not the error we expected", err) } if out != nil { t.Fatal("expected nil here") } if sess.LockCount.Load() != 1 || sess.UnlockCount.Load() != 1 { t.Fatal("invalid locking pattern") } }
explode_data.jsonl/50062
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 264 }
[ 2830, 3393, 5981, 14611, 1927, 19486, 2354, 21390, 34247, 3707, 1412, 17507, 1155, 353, 8840, 836, 8, 341, 9859, 11571, 291, 1669, 5975, 7121, 445, 16712, 291, 1465, 1138, 1903, 433, 1669, 609, 52317, 77780, 5283, 515, 197, 197, 11989, ...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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 TestWalk(t *testing.T) { testWalk(t, true, "") assert.Equal(t, 0, len(filenameToContent)) testWalk(t, false, "") assert.Equal(t, 4, len(filenameToContent)) testWalk(t, true, ".txt") assert.Equal(t, 4, len(filenameToContent)) testWalk(t, false, ".txt") assert.Equal(t, 6, len(filenameToContent)) testWalk(t, false, ".notexist") assert.Equal(t, 8, len(filenameToContent)) }
explode_data.jsonl/57669
{ "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, 48849, 1155, 353, 8840, 836, 8, 341, 18185, 48849, 1155, 11, 830, 11, 14676, 6948, 12808, 1155, 11, 220, 15, 11, 2422, 10961, 1249, 2762, 4390, 18185, 48849, 1155, 11, 895, 11, 14676, 6948, 12808, 1155, 11, 220, 19, 11, ...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
1
func Test_AddUser(t *testing.T) { passDate := time.Now().UTC().Truncate(time.Second) name := fmt.Sprintf("test_user_parts_%d", passDate.Unix()) testUser = &common.User{ Id: -1, // this should be ignored when adding. Name: name, Password: `"hashed" password`, OAuthToken: fmt.Sprintf("%s token", name), Email: fmt.Sprintf("%s@example.com", name), NotifyCycleEnd: true, NotifyVoteSelection: true, Privilege: common.PRIV_MOD, PassDate: passDate, RateLimitOverride: true, } uid, err := conn.AddUser(testUser) if err != nil { t.Fatal(err) } testUser.Id = uid if testUser.Id == -1 { t.Fatal("User Id not updated") } }
explode_data.jsonl/22008
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 359 }
[ 2830, 3393, 21346, 1474, 1155, 353, 8840, 836, 8, 341, 41431, 1916, 1669, 882, 13244, 1005, 21183, 1005, 1282, 26900, 9730, 32435, 340, 11609, 1669, 8879, 17305, 445, 1944, 3317, 33217, 18695, 67, 497, 1494, 1916, 10616, 941, 2398, 18185,...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
3
func TestGetClaimable(t *testing.T) { bc := newTestChain(t) bc.generationAmount = []int{4, 3, 2, 1} bc.decrementInterval = 2 _, err := bc.genBlocks(10) require.NoError(t, err) t.Run("first generation period", func(t *testing.T) { amount, sysfee, err := bc.CalculateClaimable(util.Fixed8FromInt64(1), 0, 2) require.NoError(t, err) require.EqualValues(t, 8, amount) require.EqualValues(t, 0, sysfee) }) t.Run("a number of full periods", func(t *testing.T) { amount, sysfee, err := bc.CalculateClaimable(util.Fixed8FromInt64(1), 0, 6) require.NoError(t, err) require.EqualValues(t, 4+4+3+3+2+2, amount) require.EqualValues(t, 0, sysfee) }) t.Run("start from the 2-nd block", func(t *testing.T) { amount, sysfee, err := bc.CalculateClaimable(util.Fixed8FromInt64(1), 1, 7) require.NoError(t, err) require.EqualValues(t, 4+3+3+2+2+1, amount) require.EqualValues(t, 0, sysfee) }) t.Run("end height after generation has ended", func(t *testing.T) { amount, sysfee, err := bc.CalculateClaimable(util.Fixed8FromInt64(1), 1, 10) require.NoError(t, err) require.EqualValues(t, 4+3+3+2+2+1+1, amount) require.EqualValues(t, 0, sysfee) }) }
explode_data.jsonl/74543
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 507 }
[ 2830, 3393, 1949, 45544, 480, 1155, 353, 8840, 836, 8, 341, 2233, 66, 1669, 501, 2271, 18837, 1155, 692, 2233, 66, 1302, 17252, 10093, 284, 3056, 396, 90, 19, 11, 220, 18, 11, 220, 17, 11, 220, 16, 532, 2233, 66, 2285, 13477, 1025...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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_Validate_NodeLocalDNS(t *testing.T) { grid := []struct { Input kops.ClusterSpec ExpectedErrors []string }{ { Input: kops.ClusterSpec{ KubeProxy: &kops.KubeProxyConfig{ ProxyMode: "iptables", }, KubeDNS: &kops.KubeDNSConfig{ Provider: "CoreDNS", NodeLocalDNS: &kops.NodeLocalDNSConfig{ Enabled: fi.Bool(true), }, }, }, ExpectedErrors: []string{}, }, { Input: kops.ClusterSpec{ Kubelet: &kops.KubeletConfigSpec{ ClusterDNS: "100.64.0.10", }, KubeProxy: &kops.KubeProxyConfig{ ProxyMode: "ipvs", }, KubeDNS: &kops.KubeDNSConfig{ Provider: "CoreDNS", NodeLocalDNS: &kops.NodeLocalDNSConfig{ Enabled: fi.Bool(true), }, }, }, ExpectedErrors: []string{"Forbidden::spec.kubelet.clusterDNS"}, }, { Input: kops.ClusterSpec{ Kubelet: &kops.KubeletConfigSpec{ ClusterDNS: "100.64.0.10", }, KubeProxy: &kops.KubeProxyConfig{ ProxyMode: "ipvs", }, KubeDNS: &kops.KubeDNSConfig{ Provider: "CoreDNS", NodeLocalDNS: &kops.NodeLocalDNSConfig{ Enabled: fi.Bool(true), }, }, Networking: &kops.NetworkingSpec{ Cilium: &kops.CiliumNetworkingSpec{}, }, }, ExpectedErrors: []string{"Forbidden::spec.kubelet.clusterDNS"}, }, { Input: kops.ClusterSpec{ Kubelet: &kops.KubeletConfigSpec{ ClusterDNS: "169.254.20.10", }, KubeProxy: &kops.KubeProxyConfig{ ProxyMode: "iptables", }, KubeDNS: &kops.KubeDNSConfig{ Provider: "CoreDNS", NodeLocalDNS: &kops.NodeLocalDNSConfig{ Enabled: fi.Bool(true), LocalIP: "169.254.20.10", }, }, Networking: &kops.NetworkingSpec{ Cilium: &kops.CiliumNetworkingSpec{}, }, }, ExpectedErrors: []string{}, }, } for _, g := range grid { errs := validateNodeLocalDNS(&g.Input, field.NewPath("spec")) testErrors(t, g.Input, errs, g.ExpectedErrors) } }
explode_data.jsonl/61623
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 1024 }
[ 2830, 3393, 62, 17926, 41340, 7319, 61088, 1155, 353, 8840, 836, 8, 341, 49018, 1669, 3056, 1235, 341, 197, 66588, 688, 595, 3721, 72883, 8327, 198, 197, 197, 18896, 13877, 3056, 917, 198, 197, 59403, 197, 197, 515, 298, 66588, 25, 59...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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 TestEntryLogfLevel(t *testing.T) { logger := New() buffer := &bytes.Buffer{} logger.Out = buffer logger.SetLevel(InfoLevel) entry := NewEntry(logger) entry.Logf(DebugLevel, "%s", "debug") assert.NotContains(t, buffer.String(), "debug", ) entry.Logf(WarnLevel, "%s", "warn") assert.Contains(t, buffer.String(), "warn", ) }
explode_data.jsonl/13869
{ "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, 5874, 2201, 69, 4449, 1155, 353, 8840, 836, 8, 341, 17060, 1669, 1532, 741, 31122, 1669, 609, 9651, 22622, 16094, 17060, 47178, 284, 4147, 198, 17060, 4202, 4449, 7, 1731, 4449, 340, 48344, 1669, 1532, 5874, 37833, 692, 4834...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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 TestContext2Plan_moduleVarWrongTypeBasic(t *testing.T) { m := testModule(t, "plan-module-wrong-var-type") p := testProvider("aws") p.DiffFn = testDiffFn ctx := testContext2(t, &ContextOpts{ Config: m, ProviderResolver: providers.ResolverFixed( map[string]providers.Factory{ "aws": testProviderFuncFixed(p), }, ), }) _, diags := ctx.Plan() if !diags.HasErrors() { t.Fatalf("succeeded; want errors") } }
explode_data.jsonl/28656
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 182 }
[ 2830, 3393, 1972, 17, 20485, 10750, 3962, 29185, 929, 15944, 1155, 353, 8840, 836, 8, 341, 2109, 1669, 1273, 3332, 1155, 11, 330, 10393, 46718, 2630, 14347, 85415, 10604, 1138, 3223, 1669, 1273, 5179, 445, 8635, 1138, 3223, 98063, 24911, ...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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 TestRepositoryRemove(t *testing.T) { for k, v := range samples { err := sr.Remove(v.ID) if k != 3 { if err != nil { t.Fatalf("sr.Remove: %d %v", k, err) } _, err = sr.Get(v.ID) if err == nil { t.Fatalf("sr.Get == nil - %d", k) } } else { if err != repo.ErrInvalidID { t.Fatalf("sr.Get != repo.ErrInvalidID") } } } }
explode_data.jsonl/75695
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 187 }
[ 2830, 3393, 4624, 13021, 1155, 353, 8840, 836, 8, 341, 2023, 595, 11, 348, 1669, 2088, 10469, 341, 197, 9859, 1669, 18962, 13270, 3747, 9910, 340, 197, 743, 595, 961, 220, 18, 341, 298, 743, 1848, 961, 2092, 341, 571, 3244, 30762, 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...
6
func TestUnwrappingRPCJSONError(t *testing.T) { buf := &bytes.Buffer{} buf.WriteString("{foo:bar}") // some invalid json dec := json.NewDecoder(buf) var x interface{} err := dec.Decode(&x) require.Error(t, err) require.IsType(t, &json.SyntaxError{}, err) wrappedErr := fmt.Errorf("%w: test error", err) err = markRPCServerError(wrappedErr) require.Error(t, err) require.Regexp(t, expectedErrMsgForRPC, err) }
explode_data.jsonl/46749
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 170 }
[ 2830, 3393, 1806, 18718, 3629, 29528, 5370, 1454, 1155, 353, 8840, 836, 8, 341, 26398, 1669, 609, 9651, 22622, 16094, 26398, 44747, 13976, 7975, 25, 2257, 55961, 442, 1045, 8318, 2951, 198, 197, 8169, 1669, 2951, 7121, 20732, 10731, 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 TestConfirmUsableBadInfoConfig(t *testing.T) { config := clientcmdapi.NewConfig() config.Clusters["missing ca"] = &clientcmdapi.Cluster{ Server: "anything", CertificateAuthority: "missing", } config.AuthInfos["error"] = &clientcmdapi.AuthInfo{ Username: "anything", Token: "here", } config.Contexts["first"] = &clientcmdapi.Context{ Cluster: "missing ca", AuthInfo: "error", } test := configValidationTest{ config: config, expectedErrorSubstring: []string{"unable to read certificate-authority"}, } test.testConfirmUsable("first", t) }
explode_data.jsonl/13480
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 236 }
[ 2830, 3393, 16728, 3558, 480, 17082, 1731, 2648, 1155, 353, 8840, 836, 8, 341, 25873, 1669, 2943, 8710, 2068, 7121, 2648, 741, 25873, 21610, 14605, 1183, 30616, 2162, 1341, 284, 609, 2972, 8710, 2068, 72883, 515, 197, 92075, 25, 2290, 3...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
1
func TestConfigSourceManager_WatchForUpdate(t *testing.T) { ctx := context.Background() manager, err := NewManager(nil) require.NoError(t, err) watchForUpdateCh := make(chan error, 1) manager.configSources = map[string]configsource.ConfigSource{ "tstcfgsrc": &testConfigSource{ ValueMap: map[string]valueEntry{ "test_selector": { Value: "test_value", WatchForUpdateFn: func() error { return <-watchForUpdateCh }, }, }, }, } originalCfg := map[string]interface{}{ "top0": map[string]interface{}{ "var0": "$tstcfgsrc:test_selector", }, } cp := configparser.NewConfigMapFromStringMap(originalCfg) _, err = manager.Resolve(ctx, cp) require.NoError(t, err) doneCh := make(chan struct{}) var errWatcher error go func() { defer close(doneCh) errWatcher = manager.WatchForUpdate() }() manager.WaitForWatcher() watchForUpdateCh <- configsource.ErrValueUpdated <-doneCh assert.ErrorIs(t, errWatcher, configsource.ErrValueUpdated) assert.NoError(t, manager.Close(ctx)) }
explode_data.jsonl/34670
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 400 }
[ 2830, 3393, 2648, 3608, 2043, 2763, 754, 2461, 4289, 1155, 353, 8840, 836, 8, 341, 20985, 1669, 2266, 19047, 741, 92272, 11, 1848, 1669, 1532, 2043, 27907, 340, 17957, 35699, 1155, 11, 1848, 692, 6692, 754, 2461, 4289, 1143, 1669, 1281,...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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 TestClient_CreateServer_validation(t *testing.T) { var err error _, err = testClient.CreateServer(&CreateServerInput{ ServiceID: "", }) if err != ErrMissingServiceID { t.Errorf("bad error: %s", err) } _, err = testClient.CreateServer(&CreateServerInput{ ServiceID: "foo", PoolID: "", }) if err != ErrMissingPool { t.Errorf("bad error: %q", err) } }
explode_data.jsonl/8320
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 147 }
[ 2830, 3393, 2959, 34325, 5475, 19416, 1155, 353, 8840, 836, 8, 341, 2405, 1848, 1465, 198, 197, 6878, 1848, 284, 1273, 2959, 7251, 5475, 2099, 4021, 5475, 2505, 515, 197, 91619, 915, 25, 8324, 197, 3518, 743, 1848, 961, 15495, 25080, ...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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 TestIncompleteTodo(t *testing.T) { r := &MemoryRepository{} s := NewService(r) userID := 1 now := time.Now() addedTodo, err := r.addTodo("complete todo", &now, userID, defaultPriority()) if err != nil { t.Fatalf("failed to add todo") } err = s.IncompleteTodo(userID, addedTodo.id) if err != nil { t.Fatalf(err.Error()) } incompletedTodo, err := r.getTodo(userID, addedTodo.id) if err != nil { t.Fatalf(err.Error()) } if incompletedTodo.completed != nil { t.Fatalf("expected incomplete todo, got completed todo") } }
explode_data.jsonl/21374
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 224 }
[ 2830, 3393, 96698, 24176, 1155, 353, 8840, 836, 8, 341, 7000, 1669, 609, 10642, 4624, 16094, 1903, 1669, 1532, 1860, 2601, 692, 19060, 915, 1669, 220, 16, 198, 80922, 1669, 882, 13244, 741, 12718, 291, 24176, 11, 1848, 1669, 435, 1364, ...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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