{"id":41779394,"url":"https://github.com/drone/ff-test-cases","last_synced_at":"2026-01-25T03:34:58.466Z","repository":{"id":41945532,"uuid":"418486049","full_name":"drone/ff-test-cases","owner":"drone","description":"Test cases for FF SDKs evaluator tests","archived":false,"fork":false,"pushed_at":"2022-12-02T09:21:42.000Z","size":87,"stargazers_count":2,"open_issues_count":0,"forks_count":2,"subscribers_count":9,"default_branch":"main","last_synced_at":"2024-06-19T19:41:19.581Z","etag":null,"topics":["feature-flags","test","testing"],"latest_commit_sha":null,"homepage":"","language":"Go","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/drone.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2021-10-18T12:15:00.000Z","updated_at":"2024-06-19T19:41:19.583Z","dependencies_parsed_at":"2022-08-12T00:10:46.595Z","dependency_job_id":null,"html_url":"https://github.com/drone/ff-test-cases","commit_stats":null,"previous_names":[],"tags_count":1,"template":false,"template_full_name":null,"purl":"pkg:github/drone/ff-test-cases","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/drone%2Fff-test-cases","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/drone%2Fff-test-cases/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/drone%2Fff-test-cases/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/drone%2Fff-test-cases/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/drone","download_url":"https://codeload.github.com/drone/ff-test-cases/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/drone%2Fff-test-cases/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":28742975,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-01-25T02:46:29.005Z","status":"ssl_error","status_checked_at":"2026-01-25T02:44:29.968Z","response_time":113,"last_error":"SSL_connect returned=1 errno=0 peeraddr=140.82.121.6:443 state=error: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["feature-flags","test","testing"],"created_at":"2026-01-25T03:34:58.397Z","updated_at":"2026-01-25T03:34:58.459Z","avatar_url":"https://github.com/drone.png","language":"Go","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Server SDK - Evaluator test cases\n\n\n## Example\nEvaluator integration test in golang. This test model can be implemented in any programming language.\n```go\npackage tests\n\nimport (\n\t\"encoding/json\"\n\t\"fmt\"\n\t\"io/ioutil\"\n\t\"path/filepath\"\n\t\"reflect\"\n\t\"testing\"\n\n\t\"github.com/harness/ff-golang-server-sdk/evaluation\"\n\n\t\"github.com/harness/ff-golang-server-sdk/log\"\n\t\"github.com/harness/ff-golang-server-sdk/pkg/repository\"\n\t\"github.com/harness/ff-golang-server-sdk/rest\"\n)\n\nconst source = \"./ff-test-cases/tests\"\n\ntype test struct {\n\tFlag     string      `json:\"flag\"`\n\tTarget   *string     `json:\"target\"`\n\tExpected interface{} `json:\"expected\"`\n}\n\ntype testFile struct {\n\tFilename string\n\tFlags    []rest.FeatureConfig `json:\"flags\"`\n\tSegments []rest.Segment       `json:\"segments\"`\n\tTargets  []evaluation.Target  `json:\"targets\"`\n\tTests    []test               `json:\"tests\"`\n}\n\nfunc loadFiles() []testFile {\n\tfiles, err := ioutil.ReadDir(source)\n\tif err != nil {\n\t\tlog.Error(err)\n\t}\n\n\tslice := make([]testFile, 0, len(files))\n\tfor _, file := range files {\n\t\tif file.IsDir() || filepath.Ext(file.Name()) != \".json\" {\n\t\t\tcontinue\n\t\t}\n\t\tif f, err := loadFile(file.Name()); err == nil {\n\t\t\tslice = append(slice, f)\n\t\t}\n\t}\n\treturn slice\n}\n\nfunc loadFile(filename string) (testFile, error) {\n\tfp := filepath.Clean(filepath.Join(source, filename))\n\tcontent, err := ioutil.ReadFile(fp)\n\tif err != nil {\n\t\tlog.Error(err)\n\t\treturn testFile{}, err\n\t}\n\n\tresult := testFile{\n\t\tFilename: filename,\n\t}\n\terr = json.Unmarshal(content, \u0026result)\n\tif err != nil {\n\t\tlog.Error(err)\n\t\treturn testFile{}, err\n\t}\n\treturn result, nil\n}\n\nfunc TestEvaluator(t *testing.T) {\n\tt.Parallel()\n\tfixtures := loadFiles()\n\tfor _, fixture := range fixtures {\n\t\tlruCache, err := repository.NewLruCache(1000)\n\t\tif err != nil {\n\t\t\tt.Error(err)\n\t\t}\n\t\trepo := repository.New(lruCache)\n\t\tevaluator, err := evaluation.NewEvaluator(repo, nil)\n\t\tif err != nil {\n\t\t\tt.Error(err)\n\t\t}\n\t\tfor _, flag := range fixture.Flags {\n\t\t\trepo.SetFlag(flag)\n\t\t}\n\t\tfor _, segment := range fixture.Segments {\n\t\t\trepo.SetSegment(segment)\n\t\t}\n\n\t\tfor _, testCase := range fixture.Tests {\n\t\t\ttestName := fmt.Sprintf(\"test fixture %s with flag %s\", fixture.Filename, testCase.Flag)\n\t\t\tif testCase.Target != nil {\n\t\t\t\ttestName = fmt.Sprintf(\"%s and target %s\", testName, *testCase.Target)\n\t\t\t}\n\t\t\tt.Run(testName, func(t *testing.T) {\n\t\t\t\tvar target *evaluation.Target\n\t\t\t\tif testCase.Target != nil {\n\t\t\t\t\tfor i, val := range fixture.Targets {\n\t\t\t\t\t\tif val.Identifier == *testCase.Target {\n\t\t\t\t\t\t\ttarget = \u0026fixture.Targets[i]\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\tvar got interface{}\n\t\t\t\tflag, err := repo.GetFlag(testCase.Flag)\n\t\t\t\tif err != nil {\n\t\t\t\t\tt.Errorf(\"flag %s not found\", testCase.Flag)\n\t\t\t\t}\n\t\t\t\tswitch flag.Kind {\n\t\t\t\tcase \"boolean\":\n\t\t\t\t\tgot = evaluator.BoolVariation(testCase.Flag, target, false)\n\t\t\t\tcase \"string\":\n\t\t\t\t\tgot = evaluator.StringVariation(testCase.Flag, target, \"blue\")\n\t\t\t\tcase \"int\":\n\t\t\t\t\tgot = evaluator.IntVariation(testCase.Flag, target, 100)\n\t\t\t\tcase \"number\":\n\t\t\t\t\tgot = evaluator.NumberVariation(testCase.Flag, target, 50.00)\n\t\t\t\tcase \"json\":\n\t\t\t\t\tgot = evaluator.JSONVariation(testCase.Flag, target, map[string]interface{}{})\n\t\t\t\t}\n\t\t\t\tif !reflect.DeepEqual(got, testCase.Expected) {\n\t\t\t\t\tt.Errorf(\"eval engine got = %v, want %v\", got, testCase.Expected)\n\t\t\t\t}\n\t\t\t})\n\t\t}\n\t}\n}\n```","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdrone%2Fff-test-cases","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fdrone%2Fff-test-cases","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdrone%2Fff-test-cases/lists"}