mirror of
https://github.com/hanzo-fi/stack.git
synced 2026-10-30 20:34:43 +00:00
* feat: first commit * feat: import wallet, fctl sdk and some stuff * fix: make hooks enabled only if changes in the code * feat: refine scripts * chore: disable pre commit hooks * chore: update payments * feat: make all hooks pass this has required modifications on almost each project * git subrepo push services/webhooks subrepo: subdir: "services/webhooks" merged: "ca5d19c5" upstream: origin: "webhooks" branch: "main" commit: "ca5d19c5" git-subrepo: version: "0.4.5" origin: "ssh://[email protected]/ingydotnet/git-subrepo" commit: "dbb99be" * chore: push backport * chore: backports * chore: backports * chore: backports * chore: backports * chore: backports * chore: remove test code * chore: backports * fix: branch * git subrepo push --branch=chore/backports --force services/fctl subrepo: subdir: "services/fctl" merged: "0d98fdaa" upstream: origin: "fctl" branch: "chore/backports" commit: "0d98fdaa" git-subrepo: version: "0.4.5" origin: "ssh://[email protected]/ingydotnet/git-subrepo" commit: "dbb99be" * feat(fctl): fix argument * git subrepo push --branch=chore/backports --force services/fctl subrepo: subdir: "services/fctl" merged: "5a7a41f9" upstream: origin: "fctl" branch: "chore/backports" commit: "5a7a41f9" git-subrepo: version: "0.4.5" origin: "ssh://[email protected]/ingydotnet/git-subrepo" commit: "dbb99be" * feat: remove ledger * git subrepo clone ledger services/ledger subrepo: subdir: "services/ledger" merged: "ad57138a" upstream: origin: "ledger" branch: "main" commit: "ad57138a" git-subrepo: version: "0.4.5" origin: "ssh://[email protected]/ingydotnet/git-subrepo" commit: "dbb99be" * feat(auth): fix dependencies * chore: backports * feat: remove ledger * feat: add ledger * feat: remove auth * feat: fetch auth main * feat: remove search * feat: add search * feat: remove submodules * feat: reomve payments * feat: add payments from main * feat: add 'yarn install' before generate sdk * feat: Update CI * feat: remove fctl * feat: add fctl * chore: go mod tidy * git subrepo push services/fctl subrepo: subdir: "services/fctl" merged: "5d4c919" upstream: origin: "fctl" branch: "main" commit: "5d4c919" git-subrepo: version: "0.4.5" origin: "ssh://[email protected]/ingydotnet/git-subrepo" commit: "dbb99be" * feat: add go-project-template * feat: update go-project-template under new go libs * git subrepo push libs/go-project-template subrepo: subdir: "libs/go-project-template" merged: "40e49f0" upstream: origin: "go-project-template" branch: "main" commit: "40e49f0" git-subrepo: version: "0.4.5" origin: "ssh://[email protected]/ingydotnet/git-subrepo" commit: "dbb99be" * fix: sdk hook * feat: Update CI * feat: Update CI * feat: Update CI * feat: Update CI * feat: Update * feat: CI Update * feat: Clear CI * feat: CI clear * fee * feat: CI * feat: Update CI * feat: Update CI * feat: Desactivate release mode * feat: Update CI * feat: Update CI * ci: upgrade * feat: update go-libs * feat(orchetration): init project * git subrepo push libs/go-project-template subrepo: subdir: "libs/go-project-template" merged: "cbead19" upstream: origin: "go-project-template" branch: "main" commit: "cbead19" git-subrepo: version: "0.4.5" origin: "ssh://[email protected]/ingydotnet/git-subrepo" commit: "dbb99be" * fix: commitlint * feat: little clean & fix pre-commit * fix: for pre-commit * ci: Improvement * ci: Improvement * ci: Improvement * ci: Improvement * ci: Improvement * chore: add machine * ci: Improvement * ci: Improvement * ci: Improvement * ci: Improvement * feat: Add all SDK * ci: Improvement * feat: Update taskfile & CI * feat: Update taskfile & CI * feat: List foliders in find * feat: List foliders in find * feat: List foliders in find * feat: List foliders in find * feat: List foliders in find * feat: List foliders in find * feat: Add GoBuild * feat: Add GoBuild * feat: Add GoBuild * feat: Add GoBuild * feat: Add GoBuild * feat: Add GoBuild * feat: Add GoBuild * feat: Add GoBuild * feat: Add GoBuild * feat: Add GoBuild * chore: Empty-Commit * feat: Add GoBuild * feat: Add GoBuild * feat: Add GoBuild * feat: Add GoBuild * feat: Add GoBuild * feat: Add GoBuild * feat: Add GoBuild * feat: Add GoBuild * feat: Add GoBuild * feat: Add GoBuild * feat: Add GoBuild * feat: Add GoBuild * feat: Add GoBuild * feat: Add GoBuild * feat: big bang * feat: big bang * feat: big bang * ci: Update * ci: Add release * ci: Update .goreleaser.yml * feat(orchestration): first working version * feat(operator): simplify * feat(operator): factorize ingress, services, auth clients... * feat(operator): remove resources * fix: auth configuration causing pods reboot * feat: Update gitpod configuration * feat(gitpod): Add Garden * feat(gitpod): Add rsync * feat(gitpod): Add packages * feat(gitpod): Add packages * feat(gitpod): Optimize configuration * feat(gitpod): restore default config * feat(gitpod): Add port 80 & 443 on qemu * feat(gitpod): Ignore .garden fodler * feat(gitpod): Upgrade qemu * feat: add 'stack' label on created objects * feat: add taskfile operator to root taskfile * feat(operator): add lint to taskfile * feat(operator): add build.Dockerfile * fix(operator): fix build.Dockerfile * fix(operator): restore service names * fix(operator): ingresses * fix(operator): fix middlewares * fix(operator): duplicate middlewares entries * fix(operator): control ingress path prefix * feat(operator): disable ingress on service if not specified in configuration * fix(fctl): membership uri * fix(orchestration): application/json content-type * feat: wip * fix: orchestration run ids * fix: catch panic on workflow executions Co-authored-by: Ragot Geoffrey <[email protected]> Co-authored-by: Antoine Gelloz <[email protected]>
104 lines
2.7 KiB
Go
104 lines
2.7 KiB
Go
package analytics
|
|
|
|
import (
|
|
"fmt"
|
|
"reflect"
|
|
"testing"
|
|
"time"
|
|
|
|
"github.com/spf13/cobra"
|
|
"github.com/spf13/viper"
|
|
"github.com/stretchr/testify/require"
|
|
)
|
|
|
|
func TestAnalyticsFlags(t *testing.T) {
|
|
type testCase struct {
|
|
name string
|
|
flagKey string
|
|
flagValue string
|
|
viperMethod interface{}
|
|
expectedValue interface{}
|
|
}
|
|
|
|
for _, testCase := range []testCase{
|
|
{
|
|
name: "using deprecated segment enabled flag",
|
|
flagKey: segmentEnabledFlag,
|
|
flagValue: "true",
|
|
viperMethod: (*viper.Viper).GetBool,
|
|
expectedValue: true,
|
|
},
|
|
{
|
|
name: "using deprecated segment write flagKey flag",
|
|
flagKey: segmentWriteKeyFlag,
|
|
flagValue: "foo:bar",
|
|
viperMethod: (*viper.Viper).GetString,
|
|
expectedValue: "foo:bar",
|
|
},
|
|
{
|
|
name: "using deprecated segment heartbeat interval flag",
|
|
flagKey: segmentHeartbeatIntervalFlag,
|
|
flagValue: "10s",
|
|
viperMethod: (*viper.Viper).GetDuration,
|
|
expectedValue: 10 * time.Second,
|
|
},
|
|
{
|
|
name: "using deprecated segment application id flag",
|
|
flagKey: segmentApplicationIdFlag,
|
|
flagValue: "foo:bar",
|
|
viperMethod: (*viper.Viper).GetString,
|
|
expectedValue: "foo:bar",
|
|
},
|
|
{
|
|
name: "using telemetry enabled flag",
|
|
flagKey: telemetryEnabledFlag,
|
|
flagValue: "true",
|
|
viperMethod: (*viper.Viper).GetBool,
|
|
expectedValue: true,
|
|
},
|
|
{
|
|
name: "using telemetry write flagKey flag",
|
|
flagKey: telemetryWriteKeyFlag,
|
|
flagValue: "foo:bar",
|
|
viperMethod: (*viper.Viper).GetString,
|
|
expectedValue: "foo:bar",
|
|
},
|
|
{
|
|
name: "using telemetry heartbeat interval flag",
|
|
flagKey: telemetryHeartbeatIntervalFlag,
|
|
flagValue: "10s",
|
|
viperMethod: (*viper.Viper).GetDuration,
|
|
expectedValue: 10 * time.Second,
|
|
},
|
|
{
|
|
name: "using telemetry application id flag",
|
|
flagKey: telemetryApplicationIdFlag,
|
|
flagValue: "foo:bar",
|
|
viperMethod: (*viper.Viper).GetString,
|
|
expectedValue: "foo:bar",
|
|
},
|
|
} {
|
|
t.Run(testCase.name, func(t *testing.T) {
|
|
v := viper.GetViper()
|
|
cmd := &cobra.Command{
|
|
Run: func(cmd *cobra.Command, args []string) {
|
|
ret := reflect.ValueOf(testCase.viperMethod).Call([]reflect.Value{
|
|
reflect.ValueOf(v),
|
|
reflect.ValueOf(testCase.flagKey),
|
|
})
|
|
require.Len(t, ret, 1)
|
|
|
|
rValue := ret[0].Interface()
|
|
require.Equal(t, testCase.expectedValue, rValue)
|
|
},
|
|
}
|
|
InitAnalyticsFlags(cmd, "xxx", true)
|
|
|
|
cmd.SetArgs([]string{fmt.Sprintf("--%s", testCase.flagKey), testCase.flagValue})
|
|
|
|
require.NoError(t, v.BindPFlags(cmd.PersistentFlags()))
|
|
require.NoError(t, cmd.Execute())
|
|
})
|
|
}
|
|
}
|