Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: add
drop-non-retryable-data
to replications commands (#330)
* feat: add drop-non-retryable-data to replications commands * refactor: use drop vs nodrop flags * chore: use the built-in PtrBool
- Loading branch information
1 parent
6a7c4f6
commit f32a55f
Showing
7 changed files
with
252 additions
and
35 deletions.
There are no files selected for viewing
Submodule openapi
updated
3 files
+2 −0 | src/oss/schemas/Replication.yml | |
+3 −0 | src/oss/schemas/ReplicationCreationRequest.yml | |
+2 −0 | src/oss/schemas/ReplicationUpdateRequest.yml |
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
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,49 @@ | ||
package replication | ||
|
||
import ( | ||
"errors" | ||
"testing" | ||
|
||
"github.com/influxdata/influx-cli/v2/api" | ||
"github.com/stretchr/testify/require" | ||
) | ||
|
||
func TestDropNonRetryableDataBoolPtrFromFlags(t *testing.T) { | ||
tests := []struct { | ||
name string | ||
dropNonRetryableData bool | ||
noDropNonRetryableData bool | ||
want *bool | ||
wantErr error | ||
}{ | ||
{ | ||
name: "both true is an error", | ||
dropNonRetryableData: true, | ||
noDropNonRetryableData: true, | ||
want: nil, | ||
wantErr: errors.New("cannot specify both --drop-non-retryable-data and --no-drop-non-retryable-data at the same time"), | ||
}, | ||
{ | ||
name: "drop is true", | ||
dropNonRetryableData: true, | ||
want: api.PtrBool(true), | ||
}, | ||
{ | ||
name: "noDrop is true", | ||
noDropNonRetryableData: true, | ||
want: api.PtrBool(false), | ||
}, | ||
{ | ||
name: "both nil is nil", | ||
want: nil, | ||
}, | ||
} | ||
|
||
for _, tt := range tests { | ||
t.Run(tt.name, func(t *testing.T) { | ||
got, err := dropNonRetryableDataBoolPtrFromFlags(tt.dropNonRetryableData, tt.noDropNonRetryableData) | ||
require.Equal(t, tt.want, got) | ||
require.Equal(t, tt.wantErr, err) | ||
}) | ||
} | ||
} |
Oops, something went wrong.