Skip to content

Commit f0fabf1

Browse files
authored
Merge pull request #116 from c4dt/fix_go_version
Fix all go version in the tests on 1.20
2 parents aca09c9 + 1a89820 commit f0fabf1

10 files changed

+25
-40
lines changed

.github/workflows/go_dvoting_test.yml

+3-3
Original file line numberDiff line numberDiff line change
@@ -12,10 +12,10 @@ jobs:
1212
name: Scenario
1313
runs-on: ubuntu-latest
1414
steps:
15-
- name: Set up Go ^1.17
16-
uses: actions/setup-go@v2
15+
- name: Use Go 1.20
16+
uses: actions/setup-go@v4
1717
with:
18-
go-version: ^1.17
18+
go-version: '1.20'
1919

2020
- name: Install crypto util from Dela
2121
run: |

.github/workflows/go_integration_tests.yml

+12-12
Original file line numberDiff line numberDiff line change
@@ -11,10 +11,10 @@ jobs:
1111
name: Integration test
1212
runs-on: ubuntu-latest
1313
steps:
14-
- name: Set up Go ^1.17
15-
uses: actions/setup-go@v2
14+
- name: Use Go 1.20
15+
uses: actions/setup-go@v4
1616
with:
17-
go-version: ^1.17
17+
go-version: '1.20'
1818

1919
- name: Check out code into the Go module directory
2020
uses: actions/checkout@v2
@@ -25,10 +25,10 @@ jobs:
2525
name: Test bad vote
2626
runs-on: ubuntu-latest
2727
steps:
28-
- name: Set up Go ^1.17
29-
uses: actions/setup-go@v2
28+
- name: Use Go 1.20
29+
uses: actions/setup-go@v4
3030
with:
31-
go-version: ^1.17
31+
go-version: '1.20'
3232

3333
- name: Check out code into the Go module directory
3434
uses: actions/checkout@v2
@@ -39,10 +39,10 @@ jobs:
3939
name: Test crash
4040
runs-on: ubuntu-latest
4141
steps:
42-
- name: Set up Go ^1.17
43-
uses: actions/setup-go@v2
42+
- name: Use Go 1.20
43+
uses: actions/setup-go@v4
4444
with:
45-
go-version: ^1.17
45+
go-version: '1.20'
4646

4747
- name: Check out code into the Go module directory
4848
uses: actions/checkout@v2
@@ -53,10 +53,10 @@ jobs:
5353
name: Test revote
5454
runs-on: ubuntu-latest
5555
steps:
56-
- name: Set up Go ^1.17
57-
uses: actions/setup-go@v2
56+
- name: Use Go 1.20
57+
uses: actions/setup-go@v4
5858
with:
59-
go-version: ^1.17
59+
go-version: '1.20'
6060

6161
- name: Check out code into the Go module directory
6262
uses: actions/checkout@v2

.github/workflows/go_scenario_test.yml

+3-3
Original file line numberDiff line numberDiff line change
@@ -11,10 +11,10 @@ jobs:
1111
name: Tests
1212
runs-on: ubuntu-latest
1313
steps:
14-
- name: Set up Go ^1.17
15-
uses: actions/setup-go@v2
14+
- name: Use Go 1.20
15+
uses: actions/setup-go@v4
1616
with:
17-
go-version: ^1.17
17+
go-version: '1.20'
1818

1919
- name: Install crypto util from Dela
2020
run: |

.github/workflows/go_test.yml

+3-3
Original file line numberDiff line numberDiff line change
@@ -10,10 +10,10 @@ jobs:
1010
name: Tests
1111
runs-on: ubuntu-latest
1212
steps:
13-
- name: Use Go >= 1.19
14-
uses: actions/setup-go@v3
13+
- name: Use Go 1.20
14+
uses: actions/setup-go@v4
1515
with:
16-
go-version: '>=1.19'
16+
go-version: '1.20'
1717
id: go
1818

1919
- name: Check out code into the Go module directory

.github/workflows/releases.yml

+3-3
Original file line numberDiff line numberDiff line change
@@ -13,10 +13,10 @@ jobs:
1313
- name: checkout
1414
uses: actions/checkout@v3
1515

16-
- name: Use go
17-
uses: actions/setup-go@v3
16+
- name: Use Go 1.20
17+
uses: actions/setup-go@v4
1818
with:
19-
go-version: '>=1.18'
19+
go-version: '1.20'
2020

2121
- name: Install fpm
2222
run: |

go.mod

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
module github.com/c4dt/d-voting
22

3-
go 1.19
3+
go 1.20
44

55
require (
66
github.com/gorilla/mux v1.8.0

integration/integration_test.go

-6
Original file line numberDiff line numberDiff line change
@@ -37,8 +37,6 @@ func getIntegrationTest(numNodes, numVotes int) func(*testing.T) {
3737
adminID := "first admin"
3838

3939
// ##### SETUP ENV #####
40-
// make tests reproducible
41-
rand.Seed(1)
4240

4341
delaPkg.Logger = delaPkg.Logger.Level(zerolog.WarnLevel)
4442

@@ -178,8 +176,6 @@ func getIntegrationTestCrash(numNodes, numVotes, failingNodes int) func(*testing
178176
adminID := "first admin"
179177

180178
// ##### SETUP ENV #####
181-
// make tests reproducible
182-
rand.Seed(1)
183179

184180
delaPkg.Logger = delaPkg.Logger.Level(zerolog.WarnLevel)
185181

@@ -328,8 +324,6 @@ func getIntegrationBenchmark(numNodes, numVotes int) func(*testing.B) {
328324
adminID := "first admin"
329325

330326
// ##### SETUP ENV #####
331-
// make tests reproducible
332-
rand.Seed(1)
333327

334328
delaPkg.Logger = delaPkg.Logger.Level(zerolog.WarnLevel)
335329

integration/performance_test.go

-3
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,6 @@ import (
44
"crypto/sha256"
55
"encoding/base64"
66
"fmt"
7-
"math/rand"
87
"os"
98
"strconv"
109
"strings"
@@ -31,8 +30,6 @@ func BenchmarkIntegration_CustomVotesScenario(b *testing.B) {
3130
adminID := "I am an admin"
3231

3332
// ##### SETUP ENV #####
34-
// make tests reproducible
35-
rand.Seed(1)
3633

3734
dirPath, err := os.MkdirTemp(os.TempDir(), "d-voting-three-votes")
3835
require.NoError(b, err)

integration/scenario_test.go

-1
Original file line numberDiff line numberDiff line change
@@ -72,7 +72,6 @@ func getScenarioTest(numNodes int, numVotes int, numForm int) func(*testing.T) {
7272

7373
func startFormProcess(wg *sync.WaitGroup, numNodes, numVotes, numSec int, proxyArray []string, t *testing.T, numForm int, testType testType) {
7474
defer wg.Done()
75-
rand.Seed(0)
7675

7776
const contentType = "application/json"
7877
secretkeyBuf, err := hex.DecodeString("28912721dfd507e198b31602fb67824856eb5a674c021d49fdccbe52f0234409")

integration/votes_test.go

-5
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,6 @@ package integration
22

33
import (
44
"fmt"
5-
"math/rand"
65
"os"
76
"strconv"
87

@@ -34,8 +33,6 @@ func getIntegrationTestBadVote(numNodes, numVotes, numBadVotes int) func(*testin
3433
adminID := "first admin"
3534

3635
// ##### SETUP ENV #####
37-
// make tests reproducible
38-
rand.Seed(1)
3936

4037
delaPkg.Logger = delaPkg.Logger.Level(zerolog.WarnLevel)
4138

@@ -174,8 +171,6 @@ func getIntegrationTestRevote(numNodes, numVotes, numRevotes int) func(*testing.
174171
adminID := "first admin"
175172

176173
// ##### SETUP ENV #####
177-
// make tests reproducible
178-
rand.Seed(1)
179174

180175
delaPkg.Logger = delaPkg.Logger.Level(zerolog.WarnLevel)
181176

0 commit comments

Comments
 (0)