-
Notifications
You must be signed in to change notification settings - Fork 6
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
7 changed files
with
98 additions
and
10 deletions.
There are no files selected for viewing
This file contains 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
This file contains 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
This file contains 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
This file contains 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
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
package testvalues | ||
|
||
import ( | ||
"embed" | ||
"fmt" | ||
"io/fs" | ||
|
||
"github.com/gobuffalo/genny/v2" | ||
|
||
"github.com/srdtrk/go-codegen/pkg/xgenny" | ||
) | ||
|
||
//go:embed files/* files/**/* | ||
var files embed.FS | ||
|
||
func NewGenerator(opts *Options) (*genny.Generator, error) { | ||
if err := opts.Validate(); err != nil { | ||
return nil, fmt.Errorf("invalid options: %w", err) | ||
} | ||
|
||
// Remove "files/" prefix | ||
subfs, err := fs.Sub(files, "files") | ||
if err != nil { | ||
return nil, fmt.Errorf("generator sub: %w", err) | ||
} | ||
|
||
g := genny.New() | ||
|
||
err = g.SelectiveFS(subfs, nil, nil, nil, nil) | ||
if err != nil { | ||
return nil, fmt.Errorf("generator selective fs: %w", err) | ||
} | ||
|
||
g.Transformer(xgenny.Transformer(opts.plushContext())) | ||
|
||
return g, nil | ||
} |
17 changes: 17 additions & 0 deletions
17
templates/interchaintestv8/testvalues/files/testvalues/values.go.plush
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
package testvalues | ||
|
||
import "time" | ||
|
||
const ( | ||
// StartingTokenAmount is the amount of tokens to give to each user at the start of the test. | ||
StartingTokenAmount int64 = 10_000_000_000 | ||
) | ||
|
||
var ( | ||
// Maximum period to deposit on a proposal. | ||
// This value overrides the default value in the gov module using the `modifyGovV1AppState` function. | ||
MaxDepositPeriod = time.Second * 10 | ||
// Duration of the voting period. | ||
// This value overrides the default value in the gov module using the `modifyGovV1AppState` function. | ||
VotingPeriod = time.Second * 30 | ||
) |
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
package testvalues | ||
|
||
import "github.com/gobuffalo/plush/v4" | ||
|
||
type Options struct{} | ||
|
||
// Validate that options are usable. | ||
func (opts *Options) Validate() error { | ||
return nil | ||
} | ||
|
||
func (opts *Options) plushContext() *plush.Context { | ||
ctx := plush.NewContext() | ||
return ctx | ||
} |