Files
ubicloud/spec/prog/setup_node_exporter_spec.rb
mohi-kalantari ec1e11a2a7 Add node_exporter installation prog to VmHost
A new prog is added to install the node_exporter on VmHosts.

A flag is also added to make sure the application will serve the
metrics on localhost instead of all network interfaces.

For the VmHosts which are already setup and do not have the app
installed we can create this strand:

Strand.create(prog: "SetupNodeExporter", label: "start",
	stack: [{subject_id: vm_host.id}])
2025-06-25 10:59:23 +02:00

19 lines
547 B
Ruby

# frozen_string_literal: true
require_relative "../model/spec_helper"
RSpec.describe Prog::SetupNodeExporter do
subject(:sn) {
described_class.new(Strand.new(prog: "SetupNodeExporter"))
}
describe "#start" do
it "Sets it up and pops" do
sshable = instance_double(Sshable, host: "1.1.1.1")
expect(sn).to receive(:sshable).and_return(sshable)
expect(sshable).to receive(:cmd).with("sudo host/bin/setup-node-exporter 1.9.1")
expect { sn.start }.to exit({"msg" => "node exporter was setup"})
end
end
end