fleet/cmd/gitops-migrate/log/options_test.go
Anthony Maxwell 288ea58bce
Feat: GitOps YAML Migration Tool (#32237)
# Overview

This pull request resolves #31165, implementing command-line tooling to
migrate GitOps YAML files following the [changes introduced in the
upcoming 4.74
release](https://github.com/fleetdm/fleet/pull/32237/files#diff-8769f6e90e8bdf15faad8f390fdf3ffb6fd2238b7d6087d83518c21464109119R7).

Aligning with the recommended steps in the `README`; [this is an example
of the first step](https://github.com/Illbjorn/fleet/pull/3/files)
(`gitops-migrate format`) and [this is an example of the second
step](https://github.com/Illbjorn/fleet/pull/4/files) (`gitops-migrate
migrate`).

---------

Signed-off-by: Illbjorn <am@hades.so>
Co-authored-by: Ian Littman <iansltx@gmail.com>
2025-09-08 12:42:25 -04:00

34 lines
861 B
Go

package log
import (
"testing"
"github.com/stretchr/testify/require"
)
func TestOptions(t *testing.T) {
var o options
// Ensure a zero start.
require.Zero(t, o)
// Set the 'WithCaller' option via the method, ensure it's set.
o.SetWithCaller()
require.True(t, o&OptWithCaller == OptWithCaller)
// Set the 'WithLevel' option via the method, ensure both it and 'WithCaller'
// are set.
o.SetWithLevel()
require.True(t, o&OptWithCaller == OptWithCaller)
require.True(t, o&OptWithLevel == OptWithLevel)
// Unset the first ('WithCaller') option, and ensure both it is unset and
// 'WithLevel' remains set.
o.UnsetWithCaller()
require.False(t, o&OptWithCaller == OptWithCaller)
require.True(t, o&OptWithLevel == OptWithLevel)
// Unset the second ('WithLevel') option, and ensure the return to zero.
o.UnsetWithLevel()
require.Zero(t, o)
}