mirror of
https://github.com/kairos-io/kairos-agent.git
synced 2025-08-11 13:11:56 +00:00
* 🎨 Split off cli into separate binaries This commit splits off the cli into 3 binaries: - agent - cli - provider The provider now is a separate component that can be tested by itself and have its own lifecycle. This paves the way to a ligher c3os variant, HA support and other features that can be provided on runtime. This is working, but still there are low hanging fruit to care about. Fixes #14 * 🤖 Add provider bin to releases * ⚙️ Handle signals * ⚙️ Reduce buildsize footprint * 🎨 Scan for providers also in /system/providers * 🤖 Run goreleaser * 🎨 Refactoring
54 lines
1.2 KiB
Go
54 lines
1.2 KiB
Go
package provider_test
|
|
|
|
import (
|
|
"encoding/json"
|
|
"io/ioutil"
|
|
"os"
|
|
|
|
. "github.com/c3os-io/c3os/internal/provider"
|
|
"github.com/c3os-io/c3os/pkg/bus"
|
|
"github.com/c3os-io/c3os/pkg/config"
|
|
"github.com/mudler/go-pluggable"
|
|
. "github.com/onsi/ginkgo/v2"
|
|
. "github.com/onsi/gomega"
|
|
"gopkg.in/yaml.v2"
|
|
)
|
|
|
|
var _ = Describe("Bootstrap provider", func() {
|
|
Context("logging", func() {
|
|
e := &pluggable.Event{}
|
|
|
|
BeforeEach(func() {
|
|
e = &pluggable.Event{}
|
|
})
|
|
|
|
It("logs to file", func() {
|
|
f, err := ioutil.TempFile(os.TempDir(), "tests")
|
|
Expect(err).ToNot(HaveOccurred())
|
|
defer os.RemoveAll(f.Name())
|
|
|
|
cfg := &config.Config{
|
|
C3OS: &config.C3OS{
|
|
NetworkToken: "foo",
|
|
},
|
|
}
|
|
dat, err := yaml.Marshal(cfg)
|
|
Expect(err).ToNot(HaveOccurred())
|
|
payload := &bus.BootstrapPayload{Logfile: f.Name(), Config: string(dat)}
|
|
|
|
dat, err = json.Marshal(payload)
|
|
Expect(err).ToNot(HaveOccurred())
|
|
|
|
e.Data = string(dat)
|
|
resp := Bootstrap(e)
|
|
dat, _ = json.Marshal(resp)
|
|
Expect(resp.Errored()).To(BeTrue(), string(dat))
|
|
|
|
data, err := ioutil.ReadFile(f.Name())
|
|
Expect(err).ToNot(HaveOccurred())
|
|
|
|
Expect(string(data)).Should(ContainSubstring("Configuring VPN"))
|
|
})
|
|
})
|
|
})
|