Skip to content

Commit 2c9e587

Browse files
authored
Deal with os matrix / absence of docker. Update dependencies but avoid x/tools 0.25.0 which forces go 1.22 upgrade (#155)
* Deal with os matrix / absence of docker. Update dependencies but avoid x/tools 0.25.0 which forces go 1.22 upgrade * avoid issue with wrong openssl in the macos github action * switching strategy re docker * windows error is different * seems txtar/testscript files don't work on windows * more windows error message difference * Pass token down for codecov * last 2 windows error adjustments, hopefully * giving up on tescript on windows because of the -- issue
1 parent 21a9d3d commit 2c9e587

File tree

5 files changed

+53
-42
lines changed

5 files changed

+53
-42
lines changed

.github/workflows/include.yml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,8 @@ jobs:
1414
uses: fortio/workflows/.github/workflows/gochecks.yml@main
1515
call-codecov:
1616
uses: fortio/workflows/.github/workflows/codecov.yml@main
17+
secrets:
18+
CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }}
1719
call-codeql:
1820
uses: fortio/workflows/.github/workflows/codeql-analysis.yml@main
1921
call-releaser:

Makefile

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,13 @@
11
all: clean lint check test-local-image
22

3+
OS:=$(shell go env GOOS)
4+
35
test: test-local-image
6+
ifeq ($(OS),windows)
7+
@echo "Skipping test on windows, issue with -- and testscript"
8+
else
49
go test -race ./...
10+
endif
511

612
lint: .golangci.yml
713
golangci-lint run
@@ -21,9 +27,12 @@ build_no_tls_fallback:
2127
clean:
2228
rm -f multicurl
2329

30+
# on a mac with docker... run `make OS=linux` to test local docker.
2431
test-local-image: multicurl
32+
ifeq ($(OS),linux)
2533
docker build -t fortio/multicurl:local -f Dockerfile .
2634
docker run --rm fortio/multicurl:local -4 https://debug.fortio.org/build-test
35+
endif
2736

2837
.golangci.yml: Makefile
2938
curl -fsS -o .golangci.yml https://raw.githubusercontent.com/fortio/workflows/main/golangci.yml

cli/multicurl.txtar

Lines changed: 29 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -117,47 +117,47 @@ grep 'Debug server on a1' out.18.222.136.83.txt
117117

118118
# error case
119119
! multicurl -4 -i -o /doesnexist/debug.%.txt debug.fortio.org
120-
stderr '\[E\] Error creating file /doesnexist/debug.+: open /doesnexist/debug.+: no such file or directory'
120+
stderr '\[E\] Error creating file /doesnexist/debug'
121121

122122
# Weird method test - count depends on number of ip addresses for debug.fortio.org
123123
multicurl -4 -X INFO -d 'blah blah' https://debug.fortio.org
124124
stdout 'INFO / HTTP/2.0'
125125
stdout -count=3 'blah blah'
126126

127127
# Debug summary of proxy is escaping the body thus the \n
128-
multicurl -4 -d @payloadFile.txt https://debug.fortio.org
129-
stderr '\[I\] Read 23 bytes from "payloadFile.txt" as payload'
130-
stdout 'POST / HTTP/2.0'
131-
stdout 'Content-Length: 23'
132-
stdout '^body:$'
133-
stdout '^Just a test\\nof payload\\n$'
128+
[unix] multicurl -4 -d @payloadFile.txt https://debug.fortio.org
129+
[unix] stderr '\[I\] Read 23 bytes from "payloadFile.txt" as payload'
130+
[unix] stdout 'POST / HTTP/2.0'
131+
[unix] stdout 'Content-Length: 23'
132+
[unix] stdout '^body:$'
133+
[unix] stdout '^Just a test\\nof payload\\n$'
134134

135135
# payload file error
136136
! multicurl -4 -d @nosuchfile.txt https://debug.fortio.org
137-
stderr '\[F\] Unable to read payload from file "nosuchfile.txt": open nosuchfile.txt: no such file or directory'
137+
stderr '\[F\] Unable to read payload from file "nosuchfile.txt": open nosuchfile.txt'
138138

139139
# ip file error
140140
! multicurl -4 -I nosuchfile.txt https://debug.fortio.org
141-
stderr '\[F\] Unable to resolve ip4 host debug.fortio.org: open nosuchfile.txt: no such file or directory'
141+
stderr '\[F\] Unable to resolve ip4 host debug.fortio.org: open nosuchfile.txt'
142142

143143
# ip file
144-
multicurl -4 -I ips.txt https://debug.fortio.org
145-
stderr 'Using content of "ips.txt" to resolve IPs'
146-
stderr '18.222.136.83'
144+
[unix] multicurl -4 -I ips.txt https://debug.fortio.org
145+
[unix] stderr 'Using content of "ips.txt" to resolve IPs'
146+
[unix] stderr '18.222.136.83'
147147

148148
# bad ip file
149-
! multicurl -4 -I badIps.txt https://debug.fortio.org
150-
stderr '\[F\] Unable to resolve ip4 host debug.fortio.org: unable to parse IP "not-an-ip"'
149+
[unix] ! multicurl -4 -I badIps.txt https://debug.fortio.org
150+
[unix] stderr '\[F\] Unable to resolve ip4 host debug.fortio.org: unable to parse IP "not-an-ip"'
151151

152152
# good ipv6
153-
! multicurl -I ipv6.txt http://foo:9099/
154-
stderr '\[I\] Resolved ip foo:9099 to port 9099 and 2 addresses \[::1 ::2\]'
155-
stderr 'connect: connection refused'
153+
[unix] ! multicurl -I ipv6.txt http://foo:9099/
154+
[unix] stderr '\[I\] Resolved ip foo:9099 to port 9099 and 2 addresses \[::1 ::2\]'
155+
[unix] stderr 'connect: connection refused'
156156

157157
# stdin ips
158-
stdin ips.txt
159-
multicurl -4 -I - https://debug.fortio.org
160-
stderr 'Using stdin for list of IPs to connect to'
158+
[unix] stdin ips.txt
159+
[unix] multicurl -4 -I - https://debug.fortio.org
160+
[unix] stderr 'Using stdin for list of IPs to connect to'
161161

162162
# retries
163163
! multicurl -4 -repeat -1 -repeat-delay 1s -total-timeout 1.9s -expected 301 http://debug.fortio.org
@@ -180,7 +180,7 @@ stderr '\[I\] Certificate "CN=BadSSL Untrusted Root Certificate Authority'
180180

181181
# no such ca-cert file
182182
! multicurl -4 -cacert nosuchfile https://debug.fortio.org/
183-
stderr '\[F\] can.t read CA file: open nosuchfile: no such file or directory'
183+
stderr '\[F\] can.t read CA file: open nosuchfile:'
184184

185185
# get the server cert
186186
exec sh -c 'openssl s_client -showcerts -servername self-signed.badssl.com -connect self-signed.badssl.com:443 </dev/null | openssl x509 > test.ca'
@@ -189,17 +189,17 @@ stderr '\[I\] Certificate "CN=..badssl.com'
189189

190190
# bad client cert path
191191
! multicurl -4 -cert nosuchfile.crt -key nosuchfile.key https://debug.fortio.org/
192-
stderr '\[F\] LoadX509KeyPair error for cert nosuchfile.crt / key nosuchfile.key: open nosuchfile.crt: no such file or directory'
192+
stderr '\[F\] LoadX509KeyPair error for cert nosuchfile.crt / key nosuchfile.key: open nosuchfile.crt:'
193193

194194
# mtls test
195195
# on mac you need to use openssl from
196-
# brew install openssl@3
197-
exec curl -sS -o client.p12 https://badssl.com/certs/badssl.com-client.p12
198-
exec openssl version
199-
exec openssl pkcs12 -legacy -in client.p12 -out client.crt -clcerts -nokeys -passin pass:badssl.com
200-
exec openssl pkcs12 -legacy -in client.p12 -out client.key -nocerts -nodes -passin pass:badssl.com
201-
multicurl -4 -cert client.crt -key client.key https://client.badssl.com/
202-
stdout 'This site requires a .*client-authenticated.*TLS handshake'
196+
# brew install openssl@3 - so because CI macos doesn't have it, we tag this with linux for now.
197+
[linux] exec curl -sS -o client.p12 https://badssl.com/certs/badssl.com-client.p12
198+
[linux] exec openssl version
199+
[linux] exec openssl pkcs12 -legacy -in client.p12 -out client.crt -clcerts -nokeys -passin pass:badssl.com
200+
[linux] exec openssl pkcs12 -legacy -in client.p12 -out client.key -nocerts -nodes -passin pass:badssl.com
201+
[linux] multicurl -4 -cert client.crt -key client.key https://client.badssl.com/
202+
[linux] stdout 'This site requires a .*client-authenticated.*TLS handshake'
203203

204204
# json, no certs, no expiry
205205
multicurl -4 -n 1 -json -o none http://debug.fortio.org

go.mod

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,18 +1,18 @@
11
module fortio.org/multicurl
22

3-
go 1.18
3+
go 1.20
44

55
require (
66
fortio.org/cli v1.9.0
77
fortio.org/log v1.16.0
8-
fortio.org/testscript v0.3.1
8+
fortio.org/testscript v0.3.2
99
fortio.org/version v1.0.4
1010
)
1111

1212
require (
1313
fortio.org/struct2env v0.4.1 // indirect
1414
github.com/kortschak/goroutine v1.1.2 // indirect
15-
golang.org/x/crypto/x509roots/fallback v0.0.0-20240626151235-a6a393ffd658 // indirect
16-
golang.org/x/sys v0.8.0 // indirect
17-
golang.org/x/tools v0.8.0 // indirect
15+
golang.org/x/crypto/x509roots/fallback v0.0.0-20240916204253-42ee18b96377 // indirect
16+
golang.org/x/sys v0.25.0 // indirect
17+
golang.org/x/tools v0.24.0 // indirect
1818
)

go.sum

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -4,15 +4,15 @@ fortio.org/log v1.16.0 h1:GhU8/9NkYZmEIzvTN/DTMedDAStLJraWUUVUA2EbNDc=
44
fortio.org/log v1.16.0/go.mod h1:t58Spg9njjymvRioh5F6qKGSupEsnMjXLGWIS1i3khE=
55
fortio.org/struct2env v0.4.1 h1:rJludAMO5eBvpWplWEQNqoVDFZr4RWMQX7RUapgZyc0=
66
fortio.org/struct2env v0.4.1/go.mod h1:lENUe70UwA1zDUCX+8AsO663QCFqYaprk5lnPhjD410=
7-
fortio.org/testscript v0.3.1 h1:MmRO64AsmzaU1KlYMzAbotJIMKRGxD1XXssJnBRiMGQ=
8-
fortio.org/testscript v0.3.1/go.mod h1:7OJ+U4avooRNqc7p/VHKJadYgj9fA6+N0SbGU8FVWGs=
7+
fortio.org/testscript v0.3.2 h1:ks5V+Y6H6nmeGqnVlZuLdiFwpqXemDkEnyGgCZa/ZNA=
8+
fortio.org/testscript v0.3.2/go.mod h1:Z2kUvEDHYETV8FLxsdA6zwSZ8sZUiTNJh2Dw5c4a3Pg=
99
fortio.org/version v1.0.4 h1:FWUMpJ+hVTNc4RhvvOJzb0xesrlRmG/a+D6bjbQ4+5U=
1010
fortio.org/version v1.0.4/go.mod h1:2JQp9Ax+tm6QKiGuzR5nJY63kFeANcgrZ0osoQFDVm0=
1111
github.com/kortschak/goroutine v1.1.2 h1:lhllcCuERxMIK5cYr8yohZZScL1na+JM5JYPRclWjck=
1212
github.com/kortschak/goroutine v1.1.2/go.mod h1:zKpXs1FWN/6mXasDQzfl7g0LrGFIOiA6cLs9eXKyaMY=
13-
golang.org/x/crypto/x509roots/fallback v0.0.0-20240626151235-a6a393ffd658 h1:i7K6wQLN/0oxF7FT3tKkfMCstxoT4VGG36YIB9ZKLzI=
14-
golang.org/x/crypto/x509roots/fallback v0.0.0-20240626151235-a6a393ffd658/go.mod h1:kNa9WdvYnzFwC79zRpLRMJbdEFlhyM5RPFBBZp/wWH8=
15-
golang.org/x/sys v0.8.0 h1:EBmGv8NaZBZTWvrbjNoL6HVt+IVy3QDQpJs7VRIw3tU=
16-
golang.org/x/sys v0.8.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
17-
golang.org/x/tools v0.8.0 h1:vSDcovVPld282ceKgDimkRSC8kpaH1dgyc9UMzlt84Y=
18-
golang.org/x/tools v0.8.0/go.mod h1:JxBZ99ISMI5ViVkT1tr6tdNmXeTrcpVSD3vZ1RsRdN4=
13+
golang.org/x/crypto/x509roots/fallback v0.0.0-20240916204253-42ee18b96377 h1:aDWu69N3Si4isYMY1ppnuoGEFypX/E5l4MWA//GPClw=
14+
golang.org/x/crypto/x509roots/fallback v0.0.0-20240916204253-42ee18b96377/go.mod h1:kNa9WdvYnzFwC79zRpLRMJbdEFlhyM5RPFBBZp/wWH8=
15+
golang.org/x/sys v0.25.0 h1:r+8e+loiHxRqhXVl6ML1nO3l1+oFoWbnlu2Ehimmi34=
16+
golang.org/x/sys v0.25.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA=
17+
golang.org/x/tools v0.24.0 h1:J1shsA93PJUEVaUSaay7UXAyE8aimq3GW0pjlolpa24=
18+
golang.org/x/tools v0.24.0/go.mod h1:YhNqVBIfWHdzvTLs0d8LCuMhkKUgSUKldakyV7W/WDQ=

0 commit comments

Comments
 (0)