summaryrefslogtreecommitdiff
path: root/test/e2e-go/cli/goal/expect/goalCmdFlagsTest.exp
blob: 99638add524d24f8ab9e5f4d85b0fe6e4aa96740 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
#!/usr/bin/expect -f
set err 0
log_user 1

proc TestGoalCommandLineFlags { CMD EXPECTED_RE } {
    set PASSED 0
    eval spawn $CMD
    expect {
        timeout { puts "goal asset create timed out"; exit 1 }
        -re $EXPECTED_RE {set PASSED 1; close }
    }
    if { $PASSED == 0 } {
        puts "'$CMD' did not show expected output"
        puts "Expected regex:"
        puts $EXPECTED_RE
        puts "Actual:"
        puts $expect_out(buffer)
        exit 1
    }
}

if { [catch {

    TestGoalCommandLineFlags "goal node start -p :xxx:445" ".*is not a valid peer address.*"
    TestGoalCommandLineFlags "goal node start -p {http://1.2.3.4:5050;:xxx:445}" ".*is not a valid peer address.*"
    TestGoalCommandLineFlags "goal node start -p http://1.2.3.4:5050" "^Data directory not specified.*"
    TestGoalCommandLineFlags "goal node start -p {http://1.2.3.4:5050;5.6.7.8}" "^Data directory not specified.*"

} EXCEPTION ] } {
    puts "ERROR in Goal Start Validity test: $EXCEPTION"
    exit 1
}

if { [catch {

    TestGoalCommandLineFlags "goal asset create --decimals 0 --validrounds 0 --creator ABC --total 100" ".*can not be zero.*"
    TestGoalCommandLineFlags "goal asset create --decimals 0 --validrounds 1 --lastvalid 1 --creator ABC --total 100" "Only one of .* can be specified"

    TestGoalCommandLineFlags "goal account changeonlinestatus --validRounds 0 --online" ".*validRounds has been deprecated.*"
    TestGoalCommandLineFlags "goal account changeonlinestatus --firstRound 0 --online" ".*firstRound has been deprecated.*"
    TestGoalCommandLineFlags "goal account changeonlinestatus --validRounds 0 --online" ".*can not be zero.*"
    TestGoalCommandLineFlags "goal account changeonlinestatus --validrounds 0 --online" ".*can not be zero.*"
    TestGoalCommandLineFlags "goal account changeonlinestatus --validRounds 0 --lastvalid 1 --online" "Only one of .* can be specified"
    TestGoalCommandLineFlags "goal account changeonlinestatus --validrounds 0 --lastvalid 1 --online" "Only one of .* can be specified"

    TestGoalCommandLineFlags "goal clerk send --validrounds 0 -a 1 -t ABC -f ABC" ".*can not be zero.*"
    TestGoalCommandLineFlags "goal clerk send --validrounds 1 --lastvalid 1 -a 1 -t ABC -f ABC" "Only one of .* can be specified"

    TestGoalCommandLineFlags "goal account marknonparticipating" ".*required flag.*\"address\" not set"

} EXCEPTION ] } {
    puts "ERROR in Goal Asset Tx Validity test: $EXCEPTION"
    exit 1
}