testutil

package
v0.0.0-...-b3a6efc Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jan 23, 2023 License: Apache-2.0 Imports: 53 Imported by: 0

Documentation

Index

Constants

View Source
const (
	CoinDenom  = "uakt"
	BechPrefix = "akash"
)

CoinDenom provides ability to create coins in test functions and pass them into testutil functionality.

Variables

View Source
var DefaultDeploymentVersion = sha256.Sum256([]byte(sum256Seed))

DefaultDeploymentVersion provides consistent sha256 sum for initial Deployment.Version

Functions

func AccAddress

func AccAddress(t testing.TB) sdk.AccAddress

AccAddress provides an Account's Address bytes from a ed25519 generated private key.

func AkashCoin

func AkashCoin(t testing.TB, amount int64) sdk.Coin

AkashCoin provides simple interface to the Akash sdk.Coin type.

func AkashCoinRandom

func AkashCoinRandom(t testing.TB) sdk.Coin

AkashCoin provides simple interface to the Akash sdk.Coin type.

func AkashDecCoin

func AkashDecCoin(t testing.TB, amount int64) sdk.DecCoin

func AkashDecCoinRandom

func AkashDecCoinRandom(t testing.TB) sdk.DecCoin

func Attribute

func Attribute(t testing.TB) types.Attribute

Attribute generates a random sdk.Attribute

func Attributes

func Attributes(t testing.TB) []types.Attribute

Attributes generates a set of sdk.Attribute

func AuditedProvider

func AuditedProvider(t testing.TB) (atypes.ProviderID, atypes.Provider)

func BidID

func BidID(t testing.TB) mtypes.BidID

func BidIDForAccount

func BidIDForAccount(t testing.TB, owner, provider sdk.Address) mtypes.BidID

func CertificateRequireEqualResponse

func CertificateRequireEqualResponse(t *testing.T, cert TestCertificate, resp types.CertificateResponse, state types.Certificate_State)

func ChannelWaitForClose

func ChannelWaitForClose(t *testing.T, waitOn interface{})

func ChannelWaitForCloseUpTo

func ChannelWaitForCloseUpTo(t *testing.T, waitOn interface{}, waitFor time.Duration)

func ChannelWaitForValue

func ChannelWaitForValue(t *testing.T, waitOn interface{}) interface{}

func ChannelWaitForValueUpTo

func ChannelWaitForValueUpTo(t *testing.T, waitOn interface{}, waitFor time.Duration) interface{}

func Coin

func Coin(t testing.TB) sdk.Coin

func DecCoin

func DecCoin(t testing.TB) sdk.DecCoin

func DefaultConfig

func DefaultConfig() network.Config

DefaultConfig returns a default configuration suitable for nearly all testing requirements.

func Deployment

func Deployment(t testing.TB) dtypes.Deployment

Deployment generates a dtype.Deployment in state `DeploymentActive`

func DeploymentGroup

func DeploymentGroup(t testing.TB, did dtypes.DeploymentID, gseq uint32) dtypes.Group

DeploymentGroup generates a dtype.DepDeploymentGroup in state `GroupOpen` with a set of random required attributes

func DeploymentGroups

func DeploymentGroups(t testing.TB, did dtypes.DeploymentID, gseq uint32) []dtypes.Group

DeploymentGroups returns a set of deployment groups generated by DeploymentGroup

func DeploymentID

func DeploymentID(t testing.TB) dtypes.DeploymentID

func DeploymentIDForAccount

func DeploymentIDForAccount(t testing.TB, addr sdk.Address) dtypes.DeploymentID

func DeploymentVersion

func DeploymentVersion(t testing.TB) []byte

DeploymentVersion provides a random sha256 sum for simulating Deployments.

func GroupID

func GroupID(t testing.TB) dtypes.GroupID

func GroupIDForAccount

func GroupIDForAccount(t testing.TB, addr sdk.Address) dtypes.GroupID

func GroupSpec

func GroupSpec(t testing.TB) dtypes.GroupSpec

GroupSpec generator

func Hostname

func Hostname(t testing.TB) string

Hostname generates a random hostname with a "test.com" domain

func Key

func Key(t testing.TB) ed25519.PrivKey

func Keyring

func Keyring(t testing.TB) keyring.Keyring

func LeaseID

func LeaseID(t testing.TB) mtypes.LeaseID

func LeaseIDForAccount

func LeaseIDForAccount(t testing.TB, owner, provider sdk.Address) mtypes.LeaseID

func Logger

func Logger(t testing.TB) log.Logger

func Name

func Name(_ testing.TB, prefix string) string

Name generates a random name with the given prefix

func OrderID

func OrderID(t testing.TB) mtypes.OrderID

func OrderIDForAccount

func OrderIDForAccount(t testing.TB, addr sdk.Address) mtypes.OrderID

func ParseDeploymentEvent

func ParseDeploymentEvent(t testing.TB, events []abci.Event) sdkutil.ModuleEvent

func ParseEvent

func ParseEvent(t testing.TB, events []abci.Event) sdkutil.Event

func ParseMarketEvent

func ParseMarketEvent(t testing.TB, events []abci.Event) sdkutil.ModuleEvent

func ParseProviderEvent

func ParseProviderEvent(t testing.TB, events []abci.Event) sdkutil.ModuleEvent

func PlacementRequirements

func PlacementRequirements(t testing.TB) types.PlacementRequirements

PlacementRequirements generates placement requirements

func Provider

func Provider(t testing.TB) ptypes.Provider

func ProviderHostname

func ProviderHostname(t testing.TB) string

func RandCPUUnits

func RandCPUUnits() uint

func RandMemoryQuantity

func RandMemoryQuantity() uint64

func RandRangeInt

func RandRangeInt(min, max int) int

func RandRangeUint

func RandRangeUint(min, max uint) uint

func RandRangeUint64

func RandRangeUint64(min, max uint64) uint64

func RandStorageQuantity

func RandStorageQuantity() uint64

func ResourceUnits

func ResourceUnits(_ testing.TB) types.ResourceUnits

func Resources

func Resources(t testing.TB) []dtypes.Resource

Resources produces an attribute list for populating a Group's 'Resources' fields.

Types

type CertificateOption

type CertificateOption func(*certificateOption)

func CertificateOptionDomains

func CertificateOptionDomains(domains []string) CertificateOption

func CertificateOptionMocks

func CertificateOptionMocks(val *mocks.QueryClient) CertificateOption

func CertificateOptionNotAfter

func CertificateOptionNotAfter(tm time.Time) CertificateOption

func CertificateOptionNotBefore

func CertificateOptionNotBefore(tm time.Time) CertificateOption

type NetworkTestSuite

type NetworkTestSuite struct {
	*suite.Suite
	// contains filtered or unexported fields
}

func NewNetworkTestSuite

func NewNetworkTestSuite(cfg *sdknetworktest.Config, container interface{}) NetworkTestSuite

func (*NetworkTestSuite) Config

func (nts *NetworkTestSuite) Config() sdknetworktest.Config

func (*NetworkTestSuite) Context

func (nts *NetworkTestSuite) Context(idxT ...int) sdkclient.Context

func (*NetworkTestSuite) ContextForTest

func (nts *NetworkTestSuite) ContextForTest() sdkclient.Context

func (*NetworkTestSuite) GoContextForTest

func (nts *NetworkTestSuite) GoContextForTest() context.Context

func (*NetworkTestSuite) Network

func (nts *NetworkTestSuite) Network() *sdknetworktest.Network

func (*NetworkTestSuite) SetupSuite

func (nts *NetworkTestSuite) SetupSuite()

func (*NetworkTestSuite) SetupTest

func (nts *NetworkTestSuite) SetupTest()

func (*NetworkTestSuite) TearDownSuite

func (nts *NetworkTestSuite) TearDownSuite()

func (*NetworkTestSuite) TearDownTest

func (nts *NetworkTestSuite) TearDownTest()

func (*NetworkTestSuite) ValidateTx

func (nts *NetworkTestSuite) ValidateTx(resultData []byte) string

func (*NetworkTestSuite) Validator

func (nts *NetworkTestSuite) Validator(idxT ...int) *sdknetworktest.Validator

func (*NetworkTestSuite) WalletForTest

func (nts *NetworkTestSuite) WalletForTest() sdk.AccAddress

func (*NetworkTestSuite) WalletNameForTest

func (nts *NetworkTestSuite) WalletNameForTest() string

type TestCertificate

type TestCertificate struct {
	Cert   []tls.Certificate
	Serial big.Int
	PEM    struct {
		Cert []byte
		Priv []byte
		Pub  []byte
	}
}

func Certificate

func Certificate(t testing.TB, addr sdk.Address, opts ...CertificateOption) TestCertificate

Directories

Path Synopsis

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL