@@ -19,6 +19,7 @@ import (
1919
2020 "github.com/spf13/afero"
2121 "github.com/stretchr/testify/assert"
22+ "github.com/stretchr/testify/require"
2223)
2324
2425func TestVersions_Run (t * testing.T ) {
@@ -29,15 +30,9 @@ func TestVersions_Run(t *testing.T) {
2930 fs : fs ,
3031 }
3132
32- if err := opts .Run (); err != nil {
33- t .Fatalf ("Run() unexpected error: %v" , err )
34- }
35-
33+ require .NoError (t , opts .Run ())
3634 b , err := afero .ReadFile (fs , opts .outputPath )
37- if err != nil {
38- t .Fatalf ("ReadFile() unexpected error: %v" , err )
39- }
40-
35+ require .NoError (t , err )
4136 // Check initial versions
4237 assert .NotEmpty (t , b )
4338 assert .Contains (t , string (b ), "2023-02-01" )
@@ -52,14 +47,9 @@ func TestVersion_RunWithEnv(t *testing.T) {
5247 env : "staging" ,
5348 }
5449
55- if err := opts .Run (); err != nil {
56- t .Fatalf ("Run() unexpected error: %v" , err )
57- }
58-
50+ require .NoError (t , opts .Run ())
5951 b , err := afero .ReadFile (fs , opts .outputPath )
60- if err != nil {
61- t .Fatalf ("ReadFile() unexpected error: %v" , err )
62- }
52+ require .NoError (t , err )
6353
6454 // Check initial versions
6555 assert .NotEmpty (t , b )
@@ -75,14 +65,9 @@ func TestVersion_RunWithPreview(t *testing.T) {
7565 env : "staging" ,
7666 }
7767
78- if err := opts .Run (); err != nil {
79- t .Fatalf ("Run() unexpected error: %v" , err )
80- }
81-
68+ require .NoError (t , opts .Run ())
8269 b , err := afero .ReadFile (fs , opts .outputPath )
83- if err != nil {
84- t .Fatalf ("ReadFile() unexpected error: %v" , err )
85- }
70+ require .NoError (t , err )
8671
8772 // Check initial versions
8873 assert .NotEmpty (t , b )
@@ -100,14 +85,9 @@ func TestVersion_RunStabilityLevelPreview(t *testing.T) {
10085 stabilityLevel : "PREVIEW" ,
10186 }
10287
103- if err := opts .Run (); err != nil {
104- t .Fatalf ("Run() unexpected error: %v" , err )
105- }
106-
88+ require .NoError (t , opts .Run ())
10789 b , err := afero .ReadFile (fs , opts .outputPath )
108- if err != nil {
109- t .Fatalf ("ReadFile() unexpected error: %v" , err )
110- }
90+ require .NoError (t , err )
11191
11292 // Check initial versions
11393 assert .NotEmpty (t , b )
@@ -125,14 +105,9 @@ func TestVersion_RunStabilityLevelStable(t *testing.T) {
125105 stabilityLevel : "STABLE" ,
126106 }
127107
128- if err := opts .Run (); err != nil {
129- t .Fatalf ("Run() unexpected error: %v" , err )
130- }
131-
108+ require .NoError (t , opts .Run ())
132109 b , err := afero .ReadFile (fs , opts .outputPath )
133- if err != nil {
134- t .Fatalf ("ReadFile() unexpected error: %v" , err )
135- }
110+ require .NoError (t , err )
136111
137112 // Check initial versions
138113 assert .NotEmpty (t , b )
0 commit comments