-
Notifications
You must be signed in to change notification settings - Fork 6
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add go tests #4
base: master
Are you sure you want to change the base?
Add go tests #4
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please rename the folder go-tools
to tests
or something more reflecting what the code under the folder is. (This because there are other applications in the root dir also written in go, so this folder name doesn't make much sense)
go-tools/honest spam/honest.go
Outdated
Must(err) | ||
|
||
Must(err) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
dupped Must(err)
go-tools/blowballs/blowballs.go
Outdated
iota "github.com/iotaledger/iota.go/v2" | ||
) | ||
|
||
const blowballSize = 10 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This should be configurable through CLI.
go-tools/blowballs/blowballs.go
Outdated
m := SendDataMessage(nodeAPI, &nodeInfo.NetworkID, &parents, "blowball", string(i)) | ||
id, err := m.ID() | ||
Must(err) | ||
fmt.Println("sent blowball message ", hex.EncodeToString(id[:])) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Use log.Println
instead
go-tools/chrysalis-attacks.iml
Outdated
@@ -0,0 +1,21 @@ | |||
<?xml version="1.0" encoding="UTF-8"?> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think this file is a checkout error, can you please remove this from the PR?
go-tools/go.mod
Outdated
@@ -0,0 +1,11 @@ | |||
module github.com/iotaledger/chrysalis-tools/go-tests |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Make sure to also rename the module names after changing the go-tools
folder name.
go-tools/honest spam/honest.go
Outdated
) | ||
|
||
func main() { | ||
endpoint := flag.String("endpoint", fmt.Sprintf("http://%s:%d", nodeUrl, apiPort), "endpoint") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
flag.Parse()
isn't called
go-tools/lib/lib.go
Outdated
} | ||
|
||
func ObtainAPI(nodeUrl string, apiPort int) (*NodeAPIClient, *NodeInfoResponse) { | ||
endpoint := flag.String("endpoint", fmt.Sprintf("http://%s:%d", nodeUrl, apiPort), "endpoint") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This flag shouldn't be in this function. The caller should be set up/use the flag.
var info *iota.NodeInfoResponse | ||
|
||
func main() { | ||
endpoint := flag.String("endpoint", "http://localhost:14265", "endpoint") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
flag.Parse()
isn't called
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
temporarily removing this file
) | ||
|
||
func main() { | ||
endpoint := flag.String("endpoint", fmt.Sprintf("http://%s:%d", nodeUrl, apiPort), "endpoint") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
flag.Parse()
isn't called
tx, err := iota.NewTransactionBuilder(). | ||
AddInput(CreateInput(&genesisAddress, genesisOutput, 0)). | ||
AddOutput(CreateOutput(&address1, 825)). | ||
AddIndexationPayload(&iota.Indexation{Index: []byte("value"), Data: []byte("test")}). | ||
Build(signer) | ||
Must(err) | ||
|
||
SendValueMessage(nodeAPI, &info.NetworkID, nil, tx) | ||
|
||
tx, err = iota.NewTransactionBuilder(). | ||
AddInput(CreateInput(&genesisAddress, genesisOutput, 0)). | ||
AddOutput(CreateOutput(&address1, 825)). | ||
AddIndexationPayload(&iota.Indexation{Index: []byte("value"), Data: []byte("test")}). | ||
Build(signer) | ||
Must(err) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Does not actually send off the 2nd transaction.
Cleaned up the PR |
Adding tools written in go that are used to run tests and attacks on the tangle.
WIP