-
Notifications
You must be signed in to change notification settings - Fork 1.4k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
issue 8072: restic deprecation - warning messages
Signed-off-by: Lyndon-Li <[email protected]>
- Loading branch information
Showing
9 changed files
with
134 additions
and
31 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
Fix issue #8072, add the warning messages for restic deprecation |
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
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
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
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 |
---|---|---|
@@ -1,34 +1,47 @@ | ||
package uploader | ||
|
||
import "testing" | ||
import ( | ||
"testing" | ||
|
||
"github.com/stretchr/testify/assert" | ||
) | ||
|
||
func TestValidateUploaderType(t *testing.T) { | ||
tests := []struct { | ||
name string | ||
input string | ||
wantErr bool | ||
wantErr string | ||
wantMsg string | ||
}{ | ||
{ | ||
"'restic' is a valid type", | ||
"restic", | ||
false, | ||
"", | ||
"Uploader 'restic' is deprecated, don't use it for new backups, otherwise, the backed up data may not be accessed by new versions of Velero", | ||
}, | ||
{ | ||
"' kopia ' is a valid type (space will be trimmed)", | ||
" kopia ", | ||
false, | ||
"", | ||
"", | ||
}, | ||
{ | ||
"'anything_else' is invalid", | ||
"anything_else", | ||
true, | ||
"invalid uploader type 'anything_else', valid upload types are: 'restic', 'kopia'", | ||
"", | ||
}, | ||
} | ||
for _, tt := range tests { | ||
t.Run(tt.name, func(t *testing.T) { | ||
if err := ValidateUploaderType(tt.input); (err != nil) != tt.wantErr { | ||
t.Errorf("ValidateUploaderType(), input = '%s' error = %v, wantErr %v", tt.input, err, tt.wantErr) | ||
msg, err := ValidateUploaderType(tt.input) | ||
if tt.wantErr != "" { | ||
assert.EqualError(t, err, tt.wantErr) | ||
} else { | ||
assert.NoError(t, err) | ||
} | ||
|
||
assert.Equal(t, tt.wantMsg, msg) | ||
}) | ||
} | ||
} |
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