10BC0 nginx-go-crossplane/util_test.go at main · ornj/nginx-go-crossplane · GitHub
[go: up one dir, main page]

Skip to content
{"payload":{"allShortcutsEnabled":false,"fileTree":{"":{"items":[{"name":".github","path":".github","contentType":"directory"},{"name":"testdata","path":"testdata","contentType":"directory"},{"name":"vendor","path":"vendor","contentType":"directory"},{"name":".dockerignore","path":".dockerignore","contentType":"file"},{"name":".gitignore","path":".gitignore","contentType":"file"},{"name":".golangci.yml","path":".golangci.yml","contentType":"file"},{"name":"CODEOWNERS","path":"CODEOWNERS","contentType":"file"},{"name":"CODE_OF_CONDUCT.md","path":"CODE_OF_CONDUCT.md","contentType":"file"},{"name":"CONTRIBUTING.md","path":"CONTRIBUTING.md","contentType":"file"},{"name":"CREDITS","path":"CREDITS","contentType":"file"},{"name":"LICENSE","path":"LICENSE","contentType":"file"},{"name":"Makefile","path":"Makefile","contentType":"file"},{"name":"README.md","path":"README.md","contentType":"file"},{"name":"SECURITY.md","path":"SECURITY.md","contentType":"file"},{"name":"SUPPORT.md","path":"SUPPORT.md","contentType":"file"},{"name":"analyze.go","path":"analyze.go","contentType":"file"},{"name":"analyze_map.go","path":"analyze_map.go","contentType":"file"},{"name":"analyze_map_test.go","path":"analyze_map_test.go","contentType":"file"},{"name":"analyze_test.go","path":"analyze_test.go","contentType":"file"},{"name":"buffer.go","path":"buffer.go","contentType":"file"},{"name":"build.go","path":"build.go","contentType":"file"},{"name":"build_test.go","path":"build_test.go","contentType":"file"},{"name":"errors.go","path":"errors.go","contentType":"file"},{"name":"errors_test.go","path":"errors_test.go","contentType":"file"},{"name":"go.mod","path":"go.mod","contentType":"file"},{"name":"go.sum","path":"go.sum","contentType":"file"},{"name":"lex.go","path":"lex.go","contentType":"file"},{"name":"lex_test.go","path":"lex_test.go","contentType":"file"},{"name":"parse.go","path":"parse.go","contentType":"file"},{"name":"parse_bench_test.go","path":"parse_bench_test.go","contentType":"file"},{"name":"parse_test.go","path":"parse_test.go","contentType":"file"},{"name":"tools.go","path":"tools.go","contentType":"file"},{"name":"types.go","path":"types.go","contentType":"file"},{"name":"types_test.go","path":"types_test.go","contentType":"file"},{"name":"util.go","path":"util.go","contentType":"file"},{"name":"util_test.go","path":"util_test.go","contentType":"file"}],"totalCount":36}},"fileTreeProcessingTime":19.106951000000002,"foldersToFetch":[],"incompleteFileTree":false,"repo":{"id":733265846,"defaultBranch":"main","name":"nginx-go-crossplane","ownerLogin":"ornj","currentUserCanPush":false,"isFork":true,"isEmpty":false,"createdAt":"2023-12-19T00:01:40.000Z","ownerAvatar":"https://avatars.githubusercontent.com/u/199645?v=4","public":true,"private":false,"isOrgOwned":false},"codeLineWrapEnabled":false,"symbolsExpanded":false,"treeExpanded":true,"refInfo":{"name":"main","listCacheKey":"v0:1718141687.0","canEdit":false,"refType":"branch","currentOid":"5f46130db8a334b0607abaeee83de65d0021766c","canEditOnDefaultBranch":false,"fileExistsOnDefault":true},"path":"util_test.go","currentUser":null,"blob":{"rawLines":["/**"," * Copyright (c) F5, Inc."," *"," * This source code is licensed under the Apache License, Version 2.0 license found in the"," * LICENSE file in the root directory of this source tree."," */","","package crossplane_test","","import (","\t\"encoding/json\"","\t\"testing\"","","\t. \"github.com/nginxinc/nginx-go-crossplane\"",")","","//nolint:funlen","func TestPayload(t *testing.T) {","\tt.Parallel()","\tt.Run(\"combine\", func(t *testing.T) {","\t\tt.Parallel()","\t\tpayload := Payload{","\t\t\tConfig: []Config{","\t\t\t\t{","\t\t\t\t\tFile: \"example1.conf\",","\t\t\t\t\tParsed: Directives{","\t\t\t\t\t\t{","\t\t\t\t\t\t\tDirective: \"include\",","\t\t\t\t\t\t\tArgs: []string{\"example2.conf\"},","\t\t\t\t\t\t\tLine: 1,","\t\t\t\t\t\t\tIncludes: []int{1},","\t\t\t\t\t\t},","\t\t\t\t\t},","\t\t\t\t},","\t\t\t\t{","\t\t\t\t\tFile: \"example2.conf\",","\t\t\t\t\tParsed: Directives{","\t\t\t\t\t\t{","\t\t\t\t\t\t\tDirective: \"events\",","\t\t\t\t\t\t\tArgs: []string{},","\t\t\t\t\t\t\tLine: 1,","\t\t\t\t\t\t},","\t\t\t\t\t\t{","\t\t\t\t\t\t\tDirective: \"http\",","\t\t\t\t\t\t\tArgs: []string{},","\t\t\t\t\t\t\tLine: 2,","\t\t\t\t\t\t},","\t\t\t\t\t},","\t\t\t\t},","\t\t\t},","\t\t}","\t\texpected := Payload{","\t\t\tStatus: \"ok\",","\t\t\tErrors: []PayloadError{},","\t\t\tConfig: []Config{","\t\t\t\t{","\t\t\t\t\tFile: \"example1.conf\",","\t\t\t\t\tStatus: \"ok\",","\t\t\t\t\tErrors: []ConfigError{},","\t\t\t\t\tParsed: Directives{","\t\t\t\t\t\t{","\t\t\t\t\t\t\tDirective: \"events\",","\t\t\t\t\t\t\tArgs: []string{},","\t\t\t\t\t\t\tLine: 1,","\t\t\t\t\t\t},","\t\t\t\t\t\t{","\t\t\t\t\t\t\tDirective: \"http\",","\t\t\t\t\t\t\tArgs: []string{},","\t\t\t\t\t\t\tLine: 2,","\t\t\t\t\t\t},","\t\t\t\t\t},","\t\t\t\t},","\t\t\t},","\t\t}","\t\tcombined, err := payload.Combined()","\t\tif err != nil {","\t\t\tt.Fatal(err)","\t\t}","\t\tb1, _ := json.Marshal(expected)","\t\tb2, _ := json.Marshal(*combined)","\t\tif string(b1) != string(b2) {","\t\t\tt.Fatalf(\"expected: %s\\nbut got: %s\", b1, b2)","\t\t}","\t})","}"],"stylingDirectives":null,"colorizedLines":null,"csv":null,"csvError":null,"copilotSWEAgentEnabled":false,"dependabotInfo":{"showConfigurationBanner":false,"configFilePath":null,"networkDependabotPath":"/ornj/nginx-go-crossplane/network/updates","dismissConfigurationNoticePath":"/settings/dismiss-notice/dependabot_configuration_notice","configurationNoticeDismissed":null},"displayName":"util_test.go","displayUrl":"https://github.com/ornj/nginx-go-crossplane/blob/main/util_test.go?raw=true","headerInfo":{"blobSize":"1.56 KB","deleteTooltip":"You must be signed in to make or propose changes","editTooltip":"You must be signed in to make or propose changes","ghDesktopPath":"https://desktop.github.com","isGitLfs":false,"onBranch":true,"shortPath":"24eaa4d","siteNavLoginPath":"/login?return_to=https%3A%2F%2Fgithub.com%2Fornj%2Fnginx-go-crossplane%2Fblob%2Fmain%2Futil_test.go","isCSV":false,"isRichtext":false,"toc":null,"lineInfo":{"truncatedLoc":"85","truncatedSloc":"81"},"mode":"file"},"image":false,"isCodeownersFile":null,"isPlain":false,"isValidLegacyIssueTemplate":false,"issueTemplate":null,"discussionTemplate":null,"language":"Go","languageID":132,"large":false,"planSupportInfo":{"repoIsFork":null,"repoOwnedByCurrentUser":null,"requestFullPath":"/ornj/nginx-go-crossplane/blob/main/util_test.go","showFreeOrgGatedFeatureMessage":null,"showPlanSupportBanner":null,"upgradeDataAttributes":null,"upgradePath":null},"publishBannersInfo":{"dismissActionNoticePath":"/settings/dismiss-notice/publish_action_from_dockerfile","releasePath":"/ornj/nginx-go-crossplane/releases/new?marketplace=true","showPublishActionBanner":false},"rawBlobUrl":"https://github.com/ornj/nginx-go-crossplane/raw/refs/heads/main/util_test.go","renderImageOrRaw":false,"richText":null,"renderedFileInfo":null,"shortPath":null,"symbolsEnabled":true,"tabSize":4,"topBannersInfo":{"overridingGlobalFundingFile":false,"globalPreferredFundingPath":null,"showInvalidCitationWarning":false,"citationHelpUrl":"https://docs.github.com/github/creating-cloning-and-archiving-repositories/creating-a-repository-on-github/about-citation-files","actionsOnboardingTip":null},"truncated":false,"viewable":true,"workflowRedirectUrl":null,"symbols":null},"copilotInfo":null,"copilotAccessAllowed":false,"modelsAccessAllowed":false,"modelsRepoIntegrationEnabled":false,"isMarketplaceEnabled":true,"csrf_tokens":{"/ornj/nginx-go-crossplane/branches":{"post":"t2oAI-KTKQ5mvoPqKhZqzh2GcHx8VAX1uXKL6_-IsKvmHuTBtufL4Cxo4MWSKQtChf4n4m2gQ6tOMPEDFtnYsw"},"/repos/preferences":{"post":"ibKxySeHhYuTr1SNd2ue1nFRy9r68qKZLPtjzKarrjOx2QTgO-u9wUzA7whYZBcaM3jkE3YRPaOzerL8pivwcA"}}},"title":"nginx-go-crossplane/util_test.go at main · ornj/nginx-go-crossplane","appPayload":{"helpUrl":"https://docs.github.com","findFileWorkerPath":"/assets-cdn/worker/find-file-worker-9bd411a8e273.js","findInFileWorkerPath":"/assets-cdn/worker/find-in-file-worker-410714137fc9.js","githubDevUrl":null,"enabled_features":{"code_nav_ui_events":false,"react_blob_overlay":false,"accessible_code_button":true}}}
0