Skip to content

Commit

Permalink
Merge branch 'devel'
Browse files Browse the repository at this point in the history
  • Loading branch information
kjsanger committed Apr 17, 2023
2 parents 0c800b3 + 3844a19 commit 2a08ea0
Show file tree
Hide file tree
Showing 7 changed files with 138 additions and 44 deletions.
20 changes: 10 additions & 10 deletions .github/workflows/run-tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -19,16 +19,16 @@ jobs:
matrix:
include:
# iRODS 4.2.11 clients vs 4.2.7 server
- go: "1.17"
- go: "1.18"
irods: "4.2.11"
server_image: "wsinpg/ub-16.04-irods-4.2.7:latest"
baton: "4.0.0"
server_image: "ghcr.io/wtsi-npg/ub-16.04-irods-4.2.7:latest"
baton: "4.0.1"
experimental: false
# iRODS 4.2.11 clients vs 4.2.11 server
- go: "1.17"
- go: "1.18"
irods: "4.2.11"
server_image: "wsinpg/ub-18.04-irods-4.2.11:latest"
baton: "4.0.0"
server_image: "ghcr.io/wtsi-npg/ub-18.04-irods-4.2.11:latest"
baton: "4.0.1"
experimental: false

services:
Expand All @@ -38,10 +38,10 @@ jobs:
- 1247:1247

steps:
- uses: actions/checkout@v2
- uses: actions/checkout@v3

- name: "Set up Go ${{ matrix.go }}"
uses: actions/setup-go@v2
uses: actions/setup-go@v3
with:
go-version: ${{ matrix.go }}

Expand Down Expand Up @@ -88,7 +88,7 @@ jobs:
baton-do --version
- name: "Cache Go modules"
uses: actions/cache@v2
uses: actions/cache@v3
with:
path: |
"$HOME/go/pkg/mod"
Expand All @@ -99,7 +99,7 @@ jobs:
- name: "Install test runner"
run: |
go get github.com/onsi/ginkgo/v2/ginkgo
go install -mod=mod github.com/onsi/ginkgo/v2/ginkgo
go get github.com/onsi/gomega/...
- name: "Run tests"
Expand Down
14 changes: 13 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,13 +6,25 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0

## [Unreleased] - [![Unit tests](https://github.com/wtsi-npg/extendo/actions/workflows/run-tests.yml/badge.svg)](https://github.com/wtsi-npg/extendo/actions/workflows/run-tests.yml)

## [2.6.0] - 2023-04-17

### Fixed

- Hang when baton crashed

### Changed

- Bump github.com/onsi/ginkgo/v2 from 2.1.6 to 2.9.1
- Bump github.com/onsi/gomega from 1.20.2 to 1.27.6
- Bump github.com/stretchr/testify from 1.8.0 to 1.8.2
- Bump github.com/rs/zerolog from 1.28.0 to 1.29.0

## [2.5.0] - 2022-10-13

### Added

- Checksum verification on put


Removal of a workaround that was created for iRODS 4.1.* now allows
extendo to support iRODS' checksum verification feature for `put` operations.
This feature calculates a checksum from the local file on disk and compares
Expand Down
4 changes: 2 additions & 2 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -17,10 +17,10 @@ lint:
check: test

test:
ginkgo -r -slow-spec-threshold=30s -race
ginkgo -r -race

coverage:
ginkgo -r -slow-spec-threshold=30s -cover -coverprofile=coverage.out
ginkgo -r -cover -coverprofile=coverage.out

clean:
go clean
25 changes: 14 additions & 11 deletions client.go
Original file line number Diff line number Diff line change
Expand Up @@ -184,7 +184,7 @@ func RodsErrorCode(err error) (int32, error) {
return e.Code(), nil
default:
return int32(0),
errors.Errorf("cannot get an iRODS error code from %v", err)
errors.Errorf("cannot get an iRODS error code from error: '%v'", err)
}
}

Expand Down Expand Up @@ -419,15 +419,16 @@ func (client *Client) Start(arg ...string) (*Client, error) {

// Watch for baton sub-process completion and capture any error
go func() {
inWg.Wait()
outWg.Wait()
err := cmd.Wait()

client.Lock()
client.isRunning = false
client.stopTime = time.Now()
client.Unlock()

inWg.Wait()
outWg.Wait()

client.err <- err
close(client.err)
}()
Expand Down Expand Up @@ -473,7 +474,7 @@ func (client *Client) Runtime() time.Duration {
// error from the sub-process.
func (client *Client) StopIgnoreError() {
if err := client.Stop(); err != nil {
logs.GetLogger().Error().Err(err).Int("pid", client.pid).
logs.GetLogger().Error().Err(err).Int("pid", client.ClientPid()).
Msg("stopped client")
}
}
Expand Down Expand Up @@ -777,14 +778,13 @@ func (client *Client) putRecurse(args Args, item RodsItem) ([]RodsItem, error) {
// iRODS server is being run.
func (client *Client) execute(op string, args Args, item RodsItem) ([]RodsItem,
error) {
client.Lock()
defer client.Unlock()

if !client.isRunning {
if !client.IsRunning() {
return []RodsItem{}, errors.New("client is not running")
}

client.Lock()
client.activityTime = time.Now()
client.Unlock()

response, err := client.send(wrap(op, args, item))
if err != nil {
Expand Down Expand Up @@ -817,10 +817,13 @@ waitResponse:
case <-time.After(client.respTimeout):
// If the sub-process is running we just wait again, until either
// it responds or stops running.
if !client.isRunning {
return nil, errors.New("receiving failed")
if !client.IsRunning() {
ps := client.cmd.ProcessState
return nil, errors.Errorf("receiving failed because the client stopped. "+
"PID: %d, process state: %s", ps.Pid(), ps.String())
}
log.Debug().Str("executable", client.path).

log.Debug().Str("executable", client.path).Int("pid", client.ClientPid()).
Msg("receiving timed out, waiting again ...")
}
}
Expand Down
16 changes: 15 additions & 1 deletion client_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -163,6 +163,21 @@ var _ = Describe("List an iRODS path", func() {
})
})

When("the path does not exist and contains printf placeholders", func() {
It("should return an iRODS -310000 error", func() {
path := filepath.Join(rootColl, "%s")
item := ex.RodsItem{IPath: path}

_, err := client.ListItem(ex.Args{}, item)
Expect(err).To(HaveOccurred())

code, e := ex.RodsErrorCode(err)
Expect(e).NotTo(HaveOccurred())

Expect(code).To(Equal(ex.RodsUserFileDoesNotExist))
})
})

When("the item is a collection", func() {
BeforeEach(func() {
testColl = ex.RodsItem{IPath: filepath.Join(workColl, "testdata")}
Expand Down Expand Up @@ -430,7 +445,6 @@ var _ = Describe("List an iRODS path", func() {
})
})


var _ = Describe("Put a file into iRODS", func() {
var (
client *ex.Client
Expand Down
20 changes: 12 additions & 8 deletions go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -3,23 +3,27 @@ module github.com/wtsi-npg/extendo/v2
go 1.17

require (
github.com/onsi/ginkgo/v2 v2.1.6
github.com/onsi/gomega v1.20.2
github.com/onsi/ginkgo/v2 v2.9.2
github.com/onsi/gomega v1.27.6
github.com/pkg/errors v0.9.1
github.com/rs/zerolog v1.28.0
github.com/stretchr/testify v1.8.0
github.com/rs/zerolog v1.29.0
github.com/stretchr/testify v1.8.2
github.com/wtsi-npg/logshim v1.3.0
github.com/wtsi-npg/logshim-zerolog v1.3.0
)

require (
github.com/davecgh/go-spew v1.1.1 // indirect
github.com/google/go-cmp v0.5.8 // indirect
github.com/go-logr/logr v1.2.3 // indirect
github.com/go-task/slim-sprig v0.0.0-20230315185526-52ccab3ef572 // indirect
github.com/google/go-cmp v0.5.9 // indirect
github.com/google/pprof v0.0.0-20210407192527-94a9f03dee38 // indirect
github.com/mattn/go-colorable v0.1.12 // indirect
github.com/mattn/go-isatty v0.0.14 // indirect
github.com/pmezard/go-difflib v1.0.0 // indirect
golang.org/x/net v0.0.0-20220722155237-a158d28d115b // indirect
golang.org/x/sys v0.0.0-20220722155257-8c9f86f7a55f // indirect
golang.org/x/text v0.3.7 // indirect
golang.org/x/net v0.8.0 // indirect
golang.org/x/sys v0.6.0 // indirect
golang.org/x/text v0.8.0 // indirect
golang.org/x/tools v0.7.0 // indirect
gopkg.in/yaml.v3 v3.0.1 // indirect
)
Loading

0 comments on commit 2a08ea0

Please sign in to comment.