Skip to content

Commit

Permalink
feat(kumactl) postgres review fix
Browse files Browse the repository at this point in the history
  • Loading branch information
jakubdyszkiewicz committed Sep 19, 2019
1 parent 4651c42 commit 49507ef
Show file tree
Hide file tree
Showing 7 changed files with 20 additions and 18 deletions.
2 changes: 1 addition & 1 deletion app/kumactl/cmd/install/install_database_schema.go
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ func newInstallDatabaseSchemaCmd() *cobra.Command {
}{}
cmd := &cobra.Command{
Use: "database-schema",
Short: "Install Kuma schema on DB.",
Short: "Install Kuma schema on DB",
Long: `Install Kuma schema on DB.`,
Example: `1. kumactl install database-schema --target=postgres | PGPASSWORD=mysecretpassword psql -h localhost -U postgres
2. sql_file=$(mktemp) ; \
Expand Down
6 changes: 3 additions & 3 deletions app/kumactl/cmd/install/install_database_schema_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -9,22 +9,22 @@ import (
"path/filepath"
)

var _ = Describe("kumactl install postgres-schema", func() {
var _ = Describe("kumactl install database-schema", func() {
It("should give the schema postgres", func() {
// given
stdout := bytes.Buffer{}
rootCmd := cmd.DefaultRootCmd()
rootCmd.SetOut(&stdout)
rootCmd.SetArgs([]string{"install", "database-schema", "--target=postgres"})

bytes, err := ioutil.ReadFile(filepath.Join("testdata", "postgres_schema.sql"))
expected, err := ioutil.ReadFile(filepath.Join("testdata", "postgres_schema.golden.sql"))
Expect(err).ToNot(HaveOccurred())

// when
err = rootCmd.Execute()

// then
Expect(err).ToNot(HaveOccurred())
Expect(string(stdout.Bytes())).To(Equal(string(bytes)))
Expect(string(stdout.Bytes())).To(Equal(string(expected)))
})
})
22 changes: 12 additions & 10 deletions docs/cmd/kumactl/HELP.md
Original file line number Diff line number Diff line change
Expand Up @@ -190,7 +190,7 @@ Usage:
Available Commands:
control-plane Install Kuma Control Plane on Kubernetes
database-schema Install Kuma schema on DB.
database-schema Install Kuma schema on DB
Flags:
-h, --help help for install
Expand Down Expand Up @@ -235,27 +235,29 @@ Global Flags:
--mesh string mesh to use
```

### kumactl install postgres-schema
### kumactl install database-schema

```
Install Kuma on Kubernetes.
Install Kuma schema on DB.
Usage:
kumactl install [command]
kumactl install database-schema [flags]
Available Commands:
control-plane Install Kuma Control Plane on Kubernetes
database-schema Install Kuma schema on DB.
Examples:
1. kumactl install database-schema --target=postgres | PGPASSWORD=mysecretpassword psql -h localhost -U postgres
2. sql_file=$(mktemp) ; \
kumactl install database-schema --target=postgres >$sql_file ; \
psql --host=localhost --username=postgres --password --file=$sql_file ; \
rm $sql_file
Flags:
-h, --help help for install
-h, --help help for database-schema
--target string Database type: one of postgres (default "postgres")
Global Flags:
--config-file string path to the configuration file to use
--log-level string log level: one of off|info|debug (default "off")
--mesh string mesh to use
Use "kumactl install [command] --help" for more information about a command.
```

## kumactl get
Expand Down
4 changes: 2 additions & 2 deletions install/postgres/README.md
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
## Postgres installation

You can install Kuma on Postgres DB with following command:
Run following command for installation examples:
```bash
kumactl install postgres-schema | PGPASSWORD=mysecretpassword psql -h localhost -U postgres
kumactl install database-schema --help
```

### Schema
Expand Down
2 changes: 1 addition & 1 deletion tools/docs/kumactl/gen_help.sh
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ gen_help kumactl config control-planes remove
gen_help kumactl config control-planes switch
gen_help kumactl install
gen_help kumactl install control-plane
gen_help kumactl install postgres-schema
gen_help kumactl install database-schema
gen_help kumactl get
gen_help kumactl get meshes
gen_help kumactl get dataplanes
Expand Down
2 changes: 1 addition & 1 deletion tools/postgres/docker-compose.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -10,4 +10,4 @@ services:
ports:
- ${KUMA_STORE_POSTGRES_PORT:-15432}:5432
volumes:
- ../../app/kumactl/data/install/universal/control-plane/postgres/resource.sql:/docker-entrypoint-initdb.d/init.sql
- ../../app/kumactl/cmd/install/testdata/postgres_schema.golden.sql:/docker-entrypoint-initdb.d/init.sql

0 comments on commit 49507ef

Please sign in to comment.