fleet/test/upgrade/upgrade_test.go
Lucas Manuel Rodriguez b30a008aac
Simplify DB test/upgrade tool (#27141)
This PR simplifies the `test/upgrade` tool the QA team uses to test DB
upgrades.

- Removes "online migration" approach because we currently don't support
it (so it removes nginx as dependency).
- Adds a workflow to manually run this on Github actions (in case dev/QA
folks have issues with Docker on macOS, which is a common thing...)
- Adds logging to the output to ease troubleshoot (previous versions was
too quiet making it impossible to troubleshoot).
2025-03-14 17:07:41 -03:00

34 lines
745 B
Go

package upgrade
import (
"os"
"testing"
"github.com/stretchr/testify/require"
)
func TestUpgradeAToB(t *testing.T) {
versionA := os.Getenv("FLEET_VERSION_A")
if versionA == "" {
t.Skip("Missing environment variable FLEET_VERSION_A")
}
versionB := os.Getenv("FLEET_VERSION_B")
if versionB == "" {
t.Skip("Missing environment variable FLEET_VERSION_B")
}
f := NewFleet(t, versionA)
hostname, err := enrollHost(t, f)
require.NoError(t, err)
t.Logf("first host %s enrolled successfully", hostname)
err = f.Upgrade(versionA, versionB)
require.NoError(t, err)
// enroll another host with the new version
hostname, err = enrollHost(t, f)
require.NoError(t, err)
t.Logf("second host %s enrolled successfully", hostname)
}