kubeshop / kusk-gen

Kusk Gen generates Ingress-controller configurations from your OpenAPI definition
https://kubeshop.github.io/kusk-gen
MIT License
173 stars 12 forks source link

Wizard command fail fast is run without TTY #49

Closed kylehodgetts closed 3 years ago

kylehodgetts commented 3 years ago

Resolves #40

Wizard should only be used in an interactive context, i.e. with a terminal

To prevent the wizard command from hanging when run without TTY, we should fail fast.

Testing instructions

Vagrant required

Build kusk binary for linux export GOOS=linux; go build -o kusk-linux

Vagrantfile

Vagrant.configure("2") do |config|
  config.vm.box = "generic/ubuntu2004"
  config.vm.box_version = "3.1.16"
  config.vm.provision "file", source: "kusk-linux", destination: "kusk-linux"
end

Spin up vagrant machine vagrant up

Run wizard command without tty vagrant ssh -- -T './kusk-linux wizard -i somefile'

You can leave somefile as is; the command will fail fast before even attempting to read the input file.

Expected ~output 2021/07/26 13:14:08 the wizard is only supported in an interactive context i.e. TTY

Cleanup vagrant destroy rm Vagrantfile rm kusk-linux