This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| func TestGetSchema(t *testing.T) { | |
| ctrl := gomock.NewController(t) | |
| schemataRepositoryMock := NewMockSchemataRepository(ctrl) | |
| gitRepositoryMock := NewMockGitRepository(ctrl) | |
| somePath := "some-api.json" | |
| actualSchema := []byte(`{...}`) | |
| gitRepositoryMock.EXPECT().Clone(gomock.Any(), gomock.Any(), gomock.Any()).DoAndReturn(func(s storage.Storer, worktree billy.Filesystem, o *git.CloneOptions) (*git.Repository, error) {...}) | |
| someSchemaName := "some-api" |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| package internal | |
| import ( | |
| "github.com/go-git/go-billy/v5/memfs" | |
| "github.com/pipedrive/pdfx/diplomat" | |
| "github.com/pipedrive/pdfx/echo" | |
| "github.com/pipedrive/pdfx/logger" | |
| "github.com/pipedrive/pdfx/prometheus" | |
| "github.com/pipedrive/pdfx/runmode" | |
| "github.com/pipedrive/schemer/internal/repository" |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| func main() { | |
| pdfx.Run(internal.Module()) | |
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| func main() { | |
| log := logger.New(verbose) | |
| if err != nil { … } | |
| rawSchemata, err := os.ReadFile(SCHEMATA_LOCATION) | |
| if err != nil { … } | |
| schemata := schema.Schemata{} | |
| if err = yaml.Unmarshal(rawSchemata, &schemata); err != nil { … } | |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| fx.Run( | |
| fx.Invoke(func(o *Obj) { | |
| fmt.Println(“%s”, o.ToString()) | |
| }), | |
| fx.Provide(Foo(2)), | |
| fx.Provide(New), | |
| fx.Provide(Bar(“two”)), | |
| ) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| func New(opts …Option) *Obj { | |
| obj := new(Obj) | |
| for _, opt := range opts { | |
| opt(obj) | |
| } | |
| return obj | |
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| type Option func(*Obj) | |
| func Foo(foo int) Option { | |
| return func(obj *Obj) { | |
| obj.foo = foo | |
| } | |
| } | |
| func Bar(bar string) Option { | |
| return func(obj *Obj) { |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| type Obj struct { | |
| foo int | |
| bar string | |
| } | |
| func (o *Obj) ToString() string { | |
| return fmt.Sprintf(“obj: %d %s”, o.foo, o.bar) | |
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| test_deny_different_images { | |
| imageDefinition[{ | |
| "ciImage": "node:14-alpine", | |
| "normalImage": "php:16-alpine", | |
| }] with input as [[{ | |
| "Cmd": "from", | |
| "Flags": [], | |
| "JSON": false, | |
| "Stage": 0, | |
| "SubCmd": "", |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| imageDefinition[result] { | |
| data.neodora.files["go.mod"] == null | |
| ciImage := last_image_from_file(input) | |
| normalImage := trim_suffix(last_image_from_file(data.neodora.files.Dockerfile), "-dev") | |
| ciImage != normalImage | |
| result = { | |
| "ciImage": ciImage, | |
| "normalImage": normalImage, | |
| } | |
| } |
NewerOlder