Skip to content

Commit c58413f

Browse files
committed
update golang version to 1.24.11
- fix - call to (*testing.T).Fatalf from a non-test goroutine - set resource config to 5 sec timeout for flaky test case - set CGO_ENABLED=1 for sqlite compilation
1 parent 8c386dd commit c58413f

File tree

3,767 files changed

+1112462
-341856
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

3,767 files changed

+1112462
-341856
lines changed

.circleci/config.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ jobs:
88
- GO111MODULE=on
99
- GOPATH=/home/circleci/go
1010
- GOFLAGS=-mod=vendor
11-
- GOVERSION=1.13.15
11+
- GOVERSION=1.24.11
1212
- # OS/ARCH are for the go tooling that running on circle CI server. Not for building Fn Server
1313
- OS=linux
1414
- ARCH=amd64

CONTRIBUTING.md

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,6 @@ Graduation: Some extensions can graduate into core if they become commonplace in
3333

3434
### Build Dependencies ###
3535
- [Go](https://golang.org/doc/install)
36-
- [Dep](https://github.com/golang/dep)
3736

3837
### Getting the Repository ###
3938

Dockerfile

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,11 @@
11
ARG DIND_VERSION=24.0.9-dind
22

33
# build stage
4-
FROM golang:1.10-alpine AS build-env
5-
RUN apk --no-cache add build-base git bzr mercurial gcc
4+
FROM golang:1.24-alpine AS build-env
5+
RUN apk --no-cache add gcc musl-dev
66
ENV D=/go/src/github.com/fnproject/fn
77
ADD . $D
8-
RUN cd $D/cmd/fnserver && go build -o fn-alpine && cp fn-alpine /tmp/
8+
RUN cd $D/cmd/fnserver && CGO_ENABLED=1 go build -o fn-alpine && cp fn-alpine /tmp/
99

1010
# final stage: using docker:dind as base image
1111
FROM docker:${DIND_VERSION}

api/agent/agent_evict_test.go

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -197,7 +197,7 @@ func TestPlainNoEvict(t *testing.T) {
197197
defer wg.Done()
198198
err := execFn(`{"sleepTime": 8000}`, getFn(0), getApp(), a, 20000)
199199
if err != nil {
200-
t.Fatalf("submit should not error! %v", err)
200+
t.Errorf("submit should not error! %v", err)
201201
}
202202
}()
203203

@@ -206,7 +206,7 @@ func TestPlainNoEvict(t *testing.T) {
206206
time.Sleep(3000 * time.Millisecond)
207207
err := execFn(`{"sleepTime": 0}`, getFn(0), getApp(), a, 20000)
208208
if err != models.ErrCallTimeoutServerBusy {
209-
t.Fatalf("unexpected error %v", err)
209+
t.Errorf("unexpected error %v", err)
210210
}
211211
}()
212212

@@ -228,7 +228,7 @@ func TestPlainDoEvict(t *testing.T) {
228228
defer wg.Done()
229229
err := execFn(`{"sleepTime": 0}`, getFn(0), getApp(), a, 20000)
230230
if err != nil {
231-
t.Fatalf("submit should not error! %v", err)
231+
t.Errorf("submit should not error! %v", err)
232232
}
233233
}()
234234

@@ -237,7 +237,7 @@ func TestPlainDoEvict(t *testing.T) {
237237
time.Sleep(3000 * time.Millisecond)
238238
err := execFn(`{"sleepTime": 0}`, getFn(0), getApp(), a, 20000)
239239
if err != nil {
240-
t.Fatalf("submit should not error! %v", err)
240+
t.Errorf("submit should not error! %v", err)
241241
}
242242
}()
243243

@@ -258,7 +258,7 @@ func TestHungFDKNoEvict(t *testing.T) {
258258
defer wg.Done()
259259
err := execFn(`{"sleepTime": 0}`, getFn(11000), getApp(), a, 20000)
260260
if err != models.ErrContainerInitTimeout {
261-
t.Fatalf("submit unexpected error! %v", err)
261+
t.Errorf("submit unexpected error! %v", err)
262262
}
263263
}()
264264

@@ -267,7 +267,7 @@ func TestHungFDKNoEvict(t *testing.T) {
267267
time.Sleep(3000 * time.Millisecond)
268268
err := execFn(`{"sleepTime": 0}`, getFn(0), getApp(), a, 20000)
269269
if err != models.ErrCallTimeoutServerBusy {
270-
t.Fatalf("unexpected error %v", err)
270+
t.Errorf("unexpected error %v", err)
271271
}
272272
}()
273273

@@ -295,7 +295,7 @@ func TestDockerPullHungNoEvict(t *testing.T) {
295295

296296
err := execFn(`{"sleepTime": 0}`, fn, getApp(), a, 20000)
297297
if err != models.ErrDockerPullTimeout {
298-
t.Fatalf("unexpected error %v", err)
298+
t.Errorf("unexpected error %v", err)
299299
}
300300
}()
301301

@@ -304,7 +304,7 @@ func TestDockerPullHungNoEvict(t *testing.T) {
304304
time.Sleep(3000 * time.Millisecond)
305305
err := execFn(`{"sleepTime": 0}`, getFn(0), getApp(), a, 20000)
306306
if err != models.ErrCallTimeoutServerBusy {
307-
t.Fatalf("unexpected error %v", err)
307+
t.Errorf("unexpected error %v", err)
308308
}
309309
}()
310310

api/agent/agent_test.go

Lines changed: 6 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -698,9 +698,7 @@ func TestGetCallReturnsResourceImpossibility(t *testing.T) {
698698
}
699699
}
700700

701-
//
702701
// Tmp directory should be RW by default.
703-
//
704702
func TestTmpFsRW(t *testing.T) {
705703

706704
app := &models.App{ID: "app_id"}
@@ -1222,13 +1220,13 @@ func TestNBIOResourceTracker(t *testing.T) {
12221220
body := `{sleepTime": 10000, "isDebug": true}`
12231221
req, err := http.NewRequest("GET", call.URL, strings.NewReader(body))
12241222
if err != nil {
1225-
t.Fatal("unexpected error building request", err)
1223+
t.Errorf("unexpected error building request %v", err)
12261224
}
12271225

12281226
var outOne bytes.Buffer
12291227
callI, err := a.GetCall(FromHTTPFnRequest(app, fn, req), WithWriter(&outOne))
12301228
if err != nil {
1231-
t.Fatal(err)
1229+
t.Error(err)
12321230
}
12331231

12341232
err = a.Submit(callI)
@@ -1539,27 +1537,27 @@ func TestSlotErrorRetention(t *testing.T) {
15391537
body := fmt.Sprintf(`{"sleepTime": 5, "echoContent":"%s"}`, echoContent)
15401538
req, err := http.NewRequest("GET", url, strings.NewReader(body))
15411539
if err != nil {
1542-
t.Fatalf("unexpected error building request %v", err)
1540+
t.Errorf("unexpected error building request %v", err)
15431541
}
15441542
req = req.WithContext(ctx)
15451543

15461544
var out bytes.Buffer
15471545
callI, err := a.GetCall(FromHTTPFnRequest(app, fn, req), WithWriter(&out))
15481546
if err != nil {
1549-
t.Fatalf("unexpected error building call %v", err)
1547+
t.Errorf("unexpected error building call %v", err)
15501548
}
15511549

15521550
callI.Model().Config["ENABLE_FAIL_IF_FN_SPAWN_CALL_ID_NONMATCH"] = uniqId
15531551
callI.Model().Config["ENABLE_FAIL_IF_FN_SPAWN_CALL_ID_NONMATCH_MSEC"] = "100"
15541552

15551553
err = a.Submit(callI)
15561554
if err != nil {
1557-
t.Fatalf("submit should not error %v", err)
1555+
t.Errorf("submit should not error %v", err)
15581556
}
15591557

15601558
res, err := http.ReadResponse(bufio.NewReader(&out), nil)
15611559
if err != nil {
1562-
t.Fatalf("read resp should not error %v", err)
1560+
t.Errorf("read resp should not error %v", err)
15631561
}
15641562

15651563
checkBody(res)

api/agent/config.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -73,7 +73,7 @@ const (
7373
EnvHotPoll = "FN_HOT_POLL_MSECS"
7474
// EnvHotLauncherTimeout is the timeout for a hot container queue to persist if idle
7575
EnvHotLauncherTimeout = "FN_HOT_LAUNCHER_TIMEOUT_MSECS"
76-
// EnvHotStartTimeout is the timeout for a hot container to be created including docker-pull
76+
// EnvHotPullTimeout is the timeout for a hot container to be created including docker-pull
7777
EnvHotPullTimeout = "FN_HOT_PULL_TIMEOUT_MSECS"
7878
// EnvHotStartTimeout is the timeout for a hot container to become available for use for requests after EnvHotStartTimeout
7979
EnvHotStartTimeout = "FN_HOT_START_TIMEOUT_MSECS"

api/agent/doc.go

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,20 +1,20 @@
11
// Package agent defines the Agent interface and related concepts. An agent is
22
// an entity that knows how to execute an Fn function.
33
//
4-
// The Agent Interface
4+
// # The Agent Interface
55
//
66
// The Agent interface is the heart of this package. Agent exposes an api to
77
// create calls from various parameters and then execute those calls. An Agent
88
// has a few roles:
9-
// * manage the memory pool for a given server
10-
// * manage the container lifecycle for calls
11-
// * execute calls against containers
12-
// * invoke Start and End for each call appropriately
9+
// - manage the memory pool for a given server
10+
// - manage the container lifecycle for calls
11+
// - execute calls against containers
12+
// - invoke Start and End for each call appropriately
1313
//
1414
// For more information about how an agent executes a call see the
1515
// documentation on the Agent interface.
1616
//
17-
// Variants
17+
// # Variants
1818
//
1919
// There are two flavors of runner, the local Docker agent and a load-balancing
2020
// agent. To create an agent that uses Docker containers to execute calls, use

api/agent/drivers/doc.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,11 +3,11 @@
33
// runtimes (e.g. Docker, Rkt, etc.) and provides utlities and data types that
44
// are common across all runtimes.
55
//
6-
// Docker Driver
6+
// # Docker Driver
77
//
88
// The docker driver runs functions as Docker containers.
99
//
10-
// Mock Driver
10+
// # Mock Driver
1111
//
1212
// The mock driver pretends to run functions but doesn't actually run them. This
1313
// is for testing only.

api/agent/drivers/docker/doc.go

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
11
// Package docker provides a Docker driver for Fn. Provides an implementation
22
// of
3+
//
34
// github.com/fnproject/fn/api/agent/drivers.Driver
5+
//
46
// that knows how to run Docker images.
57
package docker

api/agent/drivers/docker/image_puller_test.go

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,7 @@ func TestImagePullConcurrent1(t *testing.T) {
5353
defer wg.Done()
5454
err := <-puller.PullImage(ctx, &cfg, img, repo, tag1)
5555
if err != nil {
56-
t.Fatalf("err received %v", err)
56+
t.Errorf("err received %v", err)
5757
}
5858
}()
5959
}
@@ -62,7 +62,7 @@ func TestImagePullConcurrent1(t *testing.T) {
6262
defer wg.Done()
6363
err := <-puller.PullImage(ctx, &cfg, img, repo, tag2)
6464
if err != nil {
65-
t.Fatalf("err received %v", err)
65+
t.Errorf("err received %v", err)
6666
}
6767
}()
6868
}
@@ -99,7 +99,7 @@ func TestImagePullConcurrent2(t *testing.T) {
9999
defer wg.Done()
100100
err := <-puller.PullImage(ctx, &cfg, img, repo, tag)
101101
if err == nil || strings.Index(err.Error(), "yogurt") == -1 {
102-
t.Fatalf("Unknown err received %v", err)
102+
t.Errorf("Unknown err received %v", err)
103103
}
104104
}()
105105
}
@@ -151,7 +151,7 @@ func TestImagePullConcurrent3(t *testing.T) {
151151
defer wg.Done()
152152
err := <-puller.PullImage(ctx, &cfg, img, repo, tag)
153153
if err == nil {
154-
t.Fatalf("no err received")
154+
t.Errorf("no err received")
155155
}
156156
}()
157157
}

0 commit comments

Comments
 (0)