difftool

package
v0.0.0-...-168a2c3 Latest Latest
Warning

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

Go to latest
Published: May 30, 2019 License: MIT Imports: 7 Imported by: 0

README

nodes internal state diff tool

Goals:

  • simplicity and completeness of tests;

  • common check approach for all test cases (including nodes switch on/off);

  • debug of consensus;

Roadmap:

  • dedicated interface provides node's internal data structs (disabled by default): inmemory interface for unit-tests, RPC-API for integration tests;

  • cause of inconsistencies seeking;

  • diff result showing a struct (Flag Table, Clotho Check List and others) and row;

Documentation

Overview

Example

Example illustrates nodes comparing.

logger := logrus.New()
logger.Level = logrus.FatalLevel

nodes := node.NewNodeList(3, logger)

stop := nodes.StartRandTxStream()
nodes.WaitForBlock(5)
stop()
for _, n := range nodes {
	n.Stop()
}
// give some time for nodes to stop actually
time.Sleep(time.Duration(5) * time.Second)

diffResult := Compare(nodes.Values()...)

if !diffResult.IsEmpty() {
	// TODO: uncomment after refactoring
	//logger.Fatal("\n" + diffResult.ToString())
}
fmt.Println("all good")
Output:

all good

Index

Examples

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Diff

type Diff struct {
	Err error `json:"-"`

	IDs             [2]uint64
	BlocksGap       int64 `json:",omitempty"`
	FirstBlockIndex int64 `json:",omitempty"`
	RoundGap        int64 `json:",omitempty"`
	FirstRoundIndex int64 `json:",omitempty"`

	Description string `json:"-"`
	// contains filtered or unexported fields
}

Diff contains and prints differences details

func (*Diff) AddDescription

func (d *Diff) AddDescription(s string)

AddDescription appends description to the diff

func (*Diff) IsEmpty

func (d *Diff) IsEmpty() bool

IsEmpty is the diff empty

func (*Diff) ToString

func (d *Diff) ToString() string

ToString converts to a string

type Result

type Result []*Diff

Result is a set of differences

func Compare

func Compare(nodes ...*node.Node) (result Result)

Compare compares each node with others

func (Result) IsEmpty

func (r Result) IsEmpty() bool

IsEmpty is the result empty

func (Result) ToString

func (r Result) ToString() string

ToString result to string

Jump to

Keyboard shortcuts

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