Merge branch 'release/0.4.2'

This commit is contained in:
Evgeniy Kulikov 2020-03-16 18:58:39 +03:00
commit 5302b8593b
No known key found for this signature in database
GPG key ID: BF6AEE0A2A699BF2
4 changed files with 63 additions and 4 deletions

View file

@ -1,5 +1,17 @@
name: Go
on: [push]
on:
push:
branches:
- master
- develop
paths-ignore:
- '*.md'
pull_request:
branches:
- master
- develop
paths-ignore:
- '*.md'
jobs:
test:
@ -7,16 +19,17 @@ jobs:
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
@ -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

View file

@ -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
@ -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

View file

@ -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 }

28
object/service_test.go Normal file
View file

@ -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() })
})
}
}