087db1de70
Since we're about to do a v3.0.0 release, let's bump the version to v3. Make this change automatically with the following command to avoid any missed items: git grep -l github.com/git-lfs/git-lfs/v2 | \ xargs sed -i -e 's!github.com/git-lfs/git-lfs/v2!github.com/git-lfs/git-lfs/v3!g'
41 lines
992 B
Go
41 lines
992 B
Go
package tq
|
|
|
|
import (
|
|
"testing"
|
|
|
|
"github.com/git-lfs/git-lfs/v3/lfsapi"
|
|
"github.com/git-lfs/git-lfs/v3/lfshttp"
|
|
"github.com/stretchr/testify/assert"
|
|
"github.com/stretchr/testify/require"
|
|
)
|
|
|
|
func TestManifestIsConfigurable(t *testing.T) {
|
|
cli, err := lfsapi.NewClient(lfshttp.NewContext(nil, nil, map[string]string{
|
|
"lfs.transfer.maxretries": "3",
|
|
}))
|
|
require.Nil(t, err)
|
|
|
|
m := NewManifest(nil, cli, "", "")
|
|
assert.Equal(t, 3, m.MaxRetries())
|
|
}
|
|
|
|
func TestManifestClampsValidValues(t *testing.T) {
|
|
cli, err := lfsapi.NewClient(lfshttp.NewContext(nil, nil, map[string]string{
|
|
"lfs.transfer.maxretries": "-1",
|
|
}))
|
|
require.Nil(t, err)
|
|
|
|
m := NewManifest(nil, cli, "", "")
|
|
assert.Equal(t, 8, m.MaxRetries())
|
|
}
|
|
|
|
func TestManifestIgnoresNonInts(t *testing.T) {
|
|
cli, err := lfsapi.NewClient(lfshttp.NewContext(nil, nil, map[string]string{
|
|
"lfs.transfer.maxretries": "not_an_int",
|
|
}))
|
|
require.Nil(t, err)
|
|
|
|
m := NewManifest(nil, cli, "", "")
|
|
assert.Equal(t, 8, m.MaxRetries())
|
|
}
|