grim/convey
Clone
Summary
Browse
Changes
Graph
Replace deprecated ioutil usage
5 months ago, Elliott Sales de Andrade
f2b1178f3266
Replace deprecated ioutil usage
It was deprecated in Go 1.16, but `go.mod` wants 1.17 already.
Testing Done:
Ran `go build .`
Reviewed at https://reviews.imfreedom.org/r/2868/
// Convey
// Copyright 2016-2018 Gary Kramlich <grim@reaperworld.com>
//
// This program is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
//
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
//
// You should have received a copy of the GNU General Public License
// along with this program. If not, see <http://www.gnu.org/licenses/>.
package
runtime
import
(
"errors"
"testing"
"github.com/stretchr/testify/assert"
)
func
TestStageShouldRunOnFailEnabled
(
t
*
testing
.
T
)
{
stage
:=
Stage
{
Enabled
:
true
}
err
:=
errors
.
New
(
"testing"
)
stage
.
Run
=
"on-failure"
assert
.
True
(
t
,
stage
.
ShouldRun
(
err
))
stage
.
Run
=
"always"
assert
.
True
(
t
,
stage
.
ShouldRun
(
err
))
stage
.
Run
=
"on-success"
assert
.
False
(
t
,
stage
.
ShouldRun
(
err
))
}
func
TestStageShouldRunOnFailDisabled
(
t
*
testing
.
T
)
{
stage
:=
Stage
{
Enabled
:
false
}
err
:=
errors
.
New
(
"testing"
)
stage
.
Run
=
"on-failure"
assert
.
False
(
t
,
stage
.
ShouldRun
(
err
))
stage
.
Run
=
"always"
assert
.
False
(
t
,
stage
.
ShouldRun
(
err
))
stage
.
Run
=
"on-success"
assert
.
False
(
t
,
stage
.
ShouldRun
(
err
))
}
func
TestStageShouldRunOnSuccessEnabled
(
t
*
testing
.
T
)
{
stage
:=
Stage
{
Enabled
:
true
}
stage
.
Run
=
"on-success"
assert
.
True
(
t
,
stage
.
ShouldRun
(
nil
))
stage
.
Run
=
"always"
assert
.
True
(
t
,
stage
.
ShouldRun
(
nil
))
stage
.
Run
=
"on-failure"
assert
.
False
(
t
,
stage
.
ShouldRun
(
nil
))
}
func
TestStageShouldRunOnSuccessDisabled
(
t
*
testing
.
T
)
{
stage
:=
Stage
{
Enabled
:
false
}
stage
.
Run
=
"on-success"
assert
.
False
(
t
,
stage
.
ShouldRun
(
nil
))
stage
.
Run
=
"always"
assert
.
False
(
t
,
stage
.
ShouldRun
(
nil
))
stage
.
Run
=
"on-failure"
assert
.
False
(
t
,
stage
.
ShouldRun
(
nil
))
}