Skip to content

Commit

Permalink
Merge branch 'release/0.4.2'
Browse files Browse the repository at this point in the history
  • Loading branch information
Evgeniy Kulikov committed Mar 16, 2020
2 parents 30d51d9 + f3d0f43 commit 5302b85
Show file tree
Hide file tree
Showing 4 changed files with 63 additions and 4 deletions.
26 changes: 23 additions & 3 deletions .github/workflows/go.yml
Original file line number Diff line number Diff line change
@@ -1,22 +1,35 @@
name: Go
on: [push]
on:
push:
branches:
- master
- develop
paths-ignore:
- '*.md'
pull_request:
branches:
- master
- develop
paths-ignore:
- '*.md'
jobs:

test:
name: test
runs-on: ubuntu-latest
strategy:
matrix:
go: [ '1.11.x', '1.12.x', '1.13.x']
go: [ '1.12.x', '1.13.x', '1.14.x']
steps:

- name: Setup go
uses: actions/setup-go@v1
with:
go-version: ${{ matrix.go }}
id: go

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

- name: Set GOPATH
# temporary fix
Expand All @@ -26,6 +39,13 @@ jobs:
echo "##[add-path]$(dirname $GITHUB_WORKSPACE)/bin"
shell: bash

- uses: actions/cache@v1
with:
path: ~/go/pkg/mod
key: ${{ runner.os }}-go-${{ hashFiles('**/go.sum') }}
restore-keys: |
${{ runner.os }}-go-
- name: Get dependencies
run: |
go get -u -v golang.org/x/lint/golint
Expand Down
6 changes: 6 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,11 @@
# Changelog
This is the changelog for NeoFS API

## [0.4.2] - 2020-03-16

### Fixed
- NPE bug with CID method of object.PutRequest

## [0.4.1] - 2020-03-02

### Changed
Expand Down Expand Up @@ -204,3 +209,4 @@ Initial public release
[0.3.2]: https://github.com/nspcc-dev/neofs-api/compare/v0.3.1...v0.3.2
[0.4.0]: https://github.com/nspcc-dev/neofs-api/compare/v0.3.2...v0.4.0
[0.4.1]: https://github.com/nspcc-dev/neofs-api/compare/v0.4.0...v0.4.1
[0.4.2]: https://github.com/nspcc-dev/neofs-api/compare/v0.4.1...v0.4.2
7 changes: 6 additions & 1 deletion object/service.go
Original file line number Diff line number Diff line change
Expand Up @@ -124,7 +124,12 @@ func (m *GetResponse) NotFull() bool { return checkIsNotFull(m) }
func (m *PutRequest) NotFull() bool { return checkIsNotFull(m) }

// CID returns container id value from object put request.
func (m *PutRequest) CID() CID { return m.GetHeader().Object.SystemHeader.CID }
func (m *PutRequest) CID() CID {
if header := m.GetHeader(); header != nil {
return header.Object.SystemHeader.CID
}
return refs.CID{}
}

// CID returns container id value from object get request.
func (m *GetRequest) CID() CID { return m.Address.CID }
Expand Down
28 changes: 28 additions & 0 deletions object/service_test.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
package object

import (
"fmt"
"testing"

"github.com/stretchr/testify/require"
)

func TestRequest(t *testing.T) {
cases := []Request{
&PutRequest{},
&GetRequest{},
&HeadRequest{},
&SearchRequest{},
&DeleteRequest{},
&GetRangeRequest{},
&GetRangeHashRequest{},
}

for i := range cases {
v := cases[i]

t.Run(fmt.Sprintf("%T", v), func(t *testing.T) {
require.NotPanics(t, func() { v.CID() })
})
}
}

0 comments on commit 5302b85

Please sign in to comment.