Skip to content

test: FCOS test coverage — ignition, install, validate, headless, bakery, vm-e2e #645

Description

@castrojo

Context

All FCOS test coverage gaps. Do last — after all implementation issues land.

Ignition tests

internal/ignition/ignition_test.go currently asserts variant: flatcar and /etc/flatcar/ paths throughout. Add parallel FCOS test functions for every existing test fixture:

func TestGenerateButane_FCOS_Header(t *testing.T) {
    // asserts variant: fcos\nversion: 1.5.0
}
func TestGenerateButane_FCOS_NoFlatcarPaths(t *testing.T) {
    // asserts /etc/flatcar/update.conf NOT present
    // asserts /etc/flatcar/enabled-sysext.conf NOT present
    // asserts update-engine.service NOT present
}
func TestGenerateButane_FCOS_ZincatiConfig(t *testing.T) {
    // asserts /etc/zincati/config.d/55-updates.toml present
    // asserts zincati.service enabled
    // asserts [updates] strategy = "immediate" for immediate strategy
}

Install tests

internal/install/install_test.go tests assert flatcar-install was called. Add FCOS variants:

func TestFCOSInstaller_CallsCoreoInstaller(t *testing.T) {
    // SpyRunner: assert "coreos-installer" called (not "flatcar-install")
    // assert args contain "install", "--stream", "stable", "--ignition-file"
    // assert wipefs NOT called
    // assert sfdisk NOT called
}

Dispatcher tests

internal/install/install_test.go — test DispatchingInstaller:

func TestDispatchingInstaller_RoutesToFlatcar(t *testing.T) { ... }
func TestDispatchingInstaller_RoutesToFCOS(t *testing.T) { ... }
func TestDispatchingInstaller_NilFCOSPanics(t *testing.T) { ... }

Validate tests

internal/validate/validate_test.go — add TestFCOSStream table-driven tests:

var fcosStreamTests = []struct{ input string; wantErr bool }{
    {"stable", false},
    {"testing", false},
    {"next", false},
    {"lts", true},    // Flatcar-only
    {"edge", true},   // Flatcar-only
    {"", true},
    {"beta", true},
}

Headless tests

internal/headless/headless_test.go — add FCOS config test cases:

  • {"os": "fcos", "channel": "stable", ...} — valid, routes to FCOS ignition
  • {"os": "fcos", "channel": "lts", ...} — invalid stream
  • {"os": "fcos", "nvidia_driver_version": "570-open", ...} — rejected
  • {"os": "flatcar", ...} — existing tests unchanged (regression gate)

FCOS stream metadata tests

internal/fcos/streams_test.go:

  • Mock HTTP server returning FCOS stream JSON
  • Assert FetchStreamFedoraVersion("stable") returns the correct major version
  • Assert error on HTTP failure
  • Assert error on malformed version string

Bakery FCOS tests

internal/bakery/bakery_fcos_test.go:

  • TestParseFCOSTagName — table-driven, covers real tag name examples from the fedora-sysexts/community catalog
  • TestFetchCatalogFCOS_FiltersCorrectFedoraVersion — mock server, assert only Fedora 44 assets returned when fedoraVersion=44

vm-e2e FCOS (Justfile — separate recipe, NOT a variant of existing)

The existing vm-e2e recipe uses:

  • flatcar_base_amd64.img as the installer disk
  • -fw_cfg name=opt/org.flatcar-linux/config,file=... for Ignition delivery
  • Flatcar-specific assertions (flatcar-update-engine.service, etc.)

For FCOS vm-e2e, these ALL change:

  • Base image: FCOS QEMU image (qcow2 format from Fedora CDN)
  • Ignition delivery: -fw_cfg name=opt/com.coreos/config,file=... (different path!)
  • Assertions: zincati.service, no update-engine.service

Add just vm-e2e-fcos as a new recipe — do not modify the existing vm-e2e. They run independently.

Acceptance criteria

  • All TestGenerateButane_FCOS_* tests pass
  • TestFCOSInstaller_* tests pass with SpyRunner
  • TestDispatchingInstaller_* tests pass
  • TestFCOSStream table-driven tests pass
  • FCOS headless config test cases pass
  • TestParseFCOSTagName covers ≥5 real tag examples
  • just ci green

Dependencies

  • All other FCOS issues

Part of epic #500

Metadata

Metadata

Assignees

No one assigned

    Labels

    1-triageNew work awaiting human triage.

    Type

    No type

    Projects

    Status
    Triage

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions