Add tests and fix some issues that arised from testing (#74)

* Add tests and fix some issues that arised from testing

Mainly around the cmdargs and how many items it returns.
Also drop the iso target and jobs as its not necessary now

Signed-off-by: Itxaka <itxaka.garcia@spectrocloud.com>

* Lint

Signed-off-by: Itxaka <itxaka.garcia@spectrocloud.com>

---------

Signed-off-by: Itxaka <itxaka.garcia@spectrocloud.com>
This commit is contained in:
Itxaka
2023-03-02 16:46:25 +01:00
committed by GitHub
parent b0b326313b
commit fecfbf8e92
22 changed files with 673 additions and 220 deletions

10
main.go
View File

@@ -3,12 +3,13 @@ package main
import (
"context"
"fmt"
"os"
"github.com/kairos-io/immucore/internal/utils"
"github.com/kairos-io/immucore/internal/version"
"github.com/kairos-io/immucore/pkg/mount"
"github.com/spectrocloud-labs/herd"
"github.com/urfave/cli/v2"
"os"
)
// Apply Immutability profiles.
@@ -27,12 +28,15 @@ func main() {
v := version.Get()
utils.Log.Info().Str("commit", v.GitCommit).Str("compiled with", v.GoVersion).Str("version", v.Version).Msg("Immucore")
cmdline, _ := os.ReadFile("/proc/cmdline")
cmdline, _ := os.ReadFile(utils.GetHostProcCmdline())
utils.Log.Debug().Str("content", string(cmdline)).Msg("cmdline")
g := herd.DAG(herd.EnableInit)
// Get targets and state
targetImage, targetDevice = utils.GetTarget(c.Bool("dry-run"))
targetImage, targetDevice, err = utils.GetTarget(c.Bool("dry-run"))
if err != nil {
return err
}
state = &mount.State{
Rootdir: utils.GetRootDir(),