Merge pull request 'fix(cli): explain the missing CI features in the version warning' (#17) from fix/version-ci-features into main
2 files · +11 -0
M internal/app/cli_version.go +2 -0
| @@ -116,5 +116,7 @@ var featureUse = map[string]string{ | |||
| 116 | 116 | client.FeatureSigningKey: "`ermite signing-key show` needs: the command will fail on this server", | |
| 117 | 117 | client.FeatureSession: "`ermite web login` needs: the command will fail on this server", | |
| 118 | 118 | client.FeatureTokenBranchPrefixes: "`ermite token create --branch-prefix` needs: the command is refused, and `token list` does not show the limits", | |
| 119 | + | client.FeatureCIRuns: "`ermite run` needs: the commands will fail on this server", | |
| 120 | + | client.FeatureCIRunners: "`ermite runner` needs: the commands will fail on this server", | |
| 119 | 121 | client.FeaturePasskeys: "`ermite web passkey` needs: the commands will fail on this server (passkeys need an https public URL with a DNS host name)", | |
| 120 | 122 | } | |
| @@ -116,5 +116,7 @@ var featureUse = map[string]string{ | |||||
| 116 | client.FeatureSigningKey: "`ermite signing-key show` needs: the command will fail on this server", | 116 | client.FeatureSigningKey: "`ermite signing-key show` needs: the command will fail on this server", | ||
| 117 | client.FeatureSession: "`ermite web login` needs: the command will fail on this server", | 117 | client.FeatureSession: "`ermite web login` needs: the command will fail on this server", | ||
| 118 | client.FeatureTokenBranchPrefixes: "`ermite token create --branch-prefix` needs: the command is refused, and `token list` does not show the limits", | 118 | client.FeatureTokenBranchPrefixes: "`ermite token create --branch-prefix` needs: the command is refused, and `token list` does not show the limits", | ||
| 119 | + | client.FeatureCIRuns: "`ermite run` needs: the commands will fail on this server", | |||
| 120 | + | client.FeatureCIRunners: "`ermite runner` needs: the commands will fail on this server", | |||
| 119 | client.FeaturePasskeys: "`ermite web passkey` needs: the commands will fail on this server (passkeys need an https public URL with a DNS host name)", | 121 | client.FeaturePasskeys: "`ermite web passkey` needs: the commands will fail on this server (passkeys need an https public URL with a DNS host name)", | ||
| 120 | } | 122 | } | ||
M internal/app/cli_version_test.go +9 -0
| @@ -12,11 +12,20 @@ import ( | |||
| 12 | 12 | "github.com/stretchr/testify/require" | |
| 13 | 13 | ||
| 14 | 14 | "bnema.dev/ermite-api/gen/ermite" | |
| 15 | + | ||
| 16 | + | "bnema.dev/ermite/internal/adapters/client" | |
| 15 | 17 | ) | |
| 16 | 18 | ||
| 17 | 19 | // allFeatures are the features this client uses. | |
| 18 | 20 | var allFeatures = []string{"repo.update", "events.resume", "merge_requests", "merge_requests.delete_branch", "signing_key", "session", "token.branch_prefixes", "ci.runs", "ci.runners", "passkeys"} | |
| 19 | 21 | ||
| 22 | + | // Every feature the client uses needs a sentence for the version warning. | |
| 23 | + | func TestEveryUsedFeatureExplainsWhatBreaks(t *testing.T) { | |
| 24 | + | for _, f := range client.UsedFeatures() { | |
| 25 | + | assert.NotEmpty(t, featureUse[f], f) | |
| 26 | + | } | |
| 27 | + | } | |
| 28 | + | ||
| 20 | 29 | func versionFake(features ...string) *fakeAPI { | |
| 21 | 30 | return &fakeAPI{getVersion: func(*ermite.GetVersionRequest) (*ermite.GetVersionResponse, error) { | |
| 22 | 31 | return &ermite.GetVersionResponse{Version: "v0.4.0", Features: features}, nil | |
| @@ -12,11 +12,20 @@ import ( | |||||
| 12 | "github.com/stretchr/testify/require" | 12 | "github.com/stretchr/testify/require" | ||
| 13 | 13 | ||||
| 14 | "bnema.dev/ermite-api/gen/ermite" | 14 | "bnema.dev/ermite-api/gen/ermite" | ||
| 15 | + | ||||
| 16 | + | "bnema.dev/ermite/internal/adapters/client" | |||
| 15 | ) | 17 | ) | ||
| 16 | 18 | ||||
| 17 | // allFeatures are the features this client uses. | 19 | // allFeatures are the features this client uses. | ||
| 18 | var allFeatures = []string{"repo.update", "events.resume", "merge_requests", "merge_requests.delete_branch", "signing_key", "session", "token.branch_prefixes", "ci.runs", "ci.runners", "passkeys"} | 20 | var allFeatures = []string{"repo.update", "events.resume", "merge_requests", "merge_requests.delete_branch", "signing_key", "session", "token.branch_prefixes", "ci.runs", "ci.runners", "passkeys"} | ||
| 19 | 21 | ||||
| 22 | + | // Every feature the client uses needs a sentence for the version warning. | |||
| 23 | + | func TestEveryUsedFeatureExplainsWhatBreaks(t *testing.T) { | |||
| 24 | + | for _, f := range client.UsedFeatures() { | |||
| 25 | + | assert.NotEmpty(t, featureUse[f], f) | |||
| 26 | + | } | |||
| 27 | + | } | |||
| 28 | + | ||||
| 20 | func versionFake(features ...string) *fakeAPI { | 29 | func versionFake(features ...string) *fakeAPI { | ||
| 21 | return &fakeAPI{getVersion: func(*ermite.GetVersionRequest) (*ermite.GetVersionResponse, error) { | 30 | return &fakeAPI{getVersion: func(*ermite.GetVersionRequest) (*ermite.GetVersionResponse, error) { | ||
| 22 | return &ermite.GetVersionResponse{Version: "v0.4.0", Features: features}, nil | 31 | return &ermite.GetVersionResponse{Version: "v0.4.0", Features: features}, nil | ||