-
Notifications
You must be signed in to change notification settings - Fork 6
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
#201 Report lack of disk space more nicely
- Loading branch information
1 parent
c100722
commit 70020ea
Showing
2 changed files
with
60 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,51 @@ | ||
package pkg | ||
|
||
import ( | ||
"github.com/stretchr/testify/assert" | ||
"testing" | ||
) | ||
|
||
func TestPackageManager_interpretFail(t *testing.T) { | ||
type fields struct { | ||
instance *Instance | ||
UploadOptimized bool | ||
InstallRecursive bool | ||
InstallHTMLEnabled bool | ||
InstallHTMLConsole bool | ||
InstallHTMLStrict bool | ||
SnapshotDeploySkipping bool | ||
SnapshotIgnored bool | ||
SnapshotPatterns []string | ||
ToggledWorkflows []string | ||
} | ||
type args struct { | ||
message string | ||
} | ||
tests := []struct { | ||
name string | ||
fields fields | ||
args args | ||
want string | ||
}{ | ||
{"no message", fields{}, args{}, "unexpected status: "}, | ||
{"generic message", fields{}, args{"generic message"}, "unexpected status: generic message"}, | ||
{"inaccessible value", fields{}, args{"Inaccessible value"}, "probably no disk space left (server respond with 'Inaccessible value')"}, | ||
} | ||
for _, tt := range tests { | ||
t.Run(tt.name, func(t *testing.T) { | ||
pm := &PackageManager{ | ||
instance: tt.fields.instance, | ||
UploadOptimized: tt.fields.UploadOptimized, | ||
InstallRecursive: tt.fields.InstallRecursive, | ||
InstallHTMLEnabled: tt.fields.InstallHTMLEnabled, | ||
InstallHTMLConsole: tt.fields.InstallHTMLConsole, | ||
InstallHTMLStrict: tt.fields.InstallHTMLStrict, | ||
SnapshotDeploySkipping: tt.fields.SnapshotDeploySkipping, | ||
SnapshotIgnored: tt.fields.SnapshotIgnored, | ||
SnapshotPatterns: tt.fields.SnapshotPatterns, | ||
ToggledWorkflows: tt.fields.ToggledWorkflows, | ||
} | ||
assert.Equalf(t, tt.want, pm.interpretFail(tt.args.message), "interpretFail(%v)", tt.args.message) | ||
}) | ||
} | ||
} |