Sha256: f5a4b0e46dd966f83c9a80fd426b89fb44ef62b9ced13c75fd83f2f7506eae11
Contents?: true
Size: 1.43 KB
Versions: 5
Compression:
Stored size: 1.43 KB
Contents
require 'kontena/cli/nodes/env_command' describe Kontena::Cli::Nodes::EnvCommand do include ClientHelpers include OutputHelpers context 'for a node created with a token' do let :node_token do { "id" => 'test-grid/node-4', "token" => 'TPnBKanfXJpi47CCvuv+Gq319AXvXBi0LL/8grXrhPr9MyqcXHsWbUy0Q3stmPGHhjaqubi5ZCwa7LbnSvZ/Iw==' } end before do expect(client).to receive(:get).with('nodes/test-grid/node-4/token').and_return(node_token) end it 'shows the node env' do expect{subject.run(['node-4'])}.to output_lines [ 'KONTENA_URI=ws://someurl.example.com/', 'KONTENA_NODE_TOKEN=TPnBKanfXJpi47CCvuv+Gq319AXvXBi0LL/8grXrhPr9MyqcXHsWbUy0Q3stmPGHhjaqubi5ZCwa7LbnSvZ/Iw==', ] end it 'shows the --token' do expect{subject.run(['--token', 'node-4'])}.to output_lines [ 'TPnBKanfXJpi47CCvuv+Gq319AXvXBi0LL/8grXrhPr9MyqcXHsWbUy0Q3stmPGHhjaqubi5ZCwa7LbnSvZ/Iw==', ] end end context 'for a node without any token' do let :node_token do { "id" => nil, "token" => nil, } end before do expect(client).to receive(:get).with('nodes/test-grid/node-1/token').and_return(node_token) end it 'uses the grid token' do expect{subject.run(['node-1'])}.to exit_with_error.and output(" [error] Node node-1 was not created with a node token. Use `kontena grid env` instead\n").to_stderr end end end
Version data entries
5 entries across 5 versions & 1 rubygems