// Code generated by mdatagen. DO NOT EDIT.

package samplescraper

import (
	"testing"

	"github.com/stretchr/testify/require"
)

func TestCreateDefaultConfig(t *testing.T) {
	cfg := createDefaultConfig().(*Config)

	require.NotNil(t, cfg)
}

func TestConfigValidate_DefaultValid(t *testing.T) {
	cfg := createDefaultConfig().(*Config)

	require.NoError(t, cfg.Validate())
}

func TestConfigValidate_RequiredJobName(t *testing.T) {
	cfg := createDefaultConfig().(*Config)
	cfg.JobName = ""

	require.ErrorContains(t, cfg.Validate(), "job_name is required")
}

func TestConfigValidate_InvalidEnumLogLevel(t *testing.T) {
	cfg := createDefaultConfig().(*Config)
	cfg.LogLevel = "__invalid__"

	require.ErrorContains(t, cfg.Validate(), "log_level must be one of")
}

func TestConfigValidate_RequiredTargets(t *testing.T) {
	cfg := createDefaultConfig().(*Config)
	cfg.Targets = nil

	require.ErrorContains(t, cfg.Validate(), "targets is required")
}

func TestSamplePkgValidate_DefaultValid(t *testing.T) {
	cfg := NewDefaultSamplePkg()

	require.NoError(t, cfg.Validate())
}

func TestConfigValidate_RequiredHostName(t *testing.T) {
	cfg := NewDefaultSamplePkg()
	cfg.HostName = ""

	require.ErrorContains(t, cfg.Validate(), "host_name is required")
}

func TestSamplePkgValidate_MinimumPort(t *testing.T) {
	cfg := NewDefaultSamplePkg()
	cfg.Port = 1 - 1

	require.ErrorContains(t, cfg.Validate(), "port value must be greater than or equal to 1")
}

func TestSamplePkgValidate_MaximumPort(t *testing.T) {
	cfg := NewDefaultSamplePkg()
	cfg.Port = 10000 + 1

	require.ErrorContains(t, cfg.Validate(), "port value must be less than or equal to 10000")
}

func TestTargetsItemValidate_DefaultValid(t *testing.T) {
	cfg := NewDefaultTargetsItem()

	require.NoError(t, cfg.Validate())
}

func TestConfigValidate_RequiredLabels(t *testing.T) {
	cfg := NewDefaultTargetsItem()
	clear(cfg.Labels)

	require.ErrorContains(t, cfg.Validate(), "labels is required")
}

func TestTargetsItemValidate_MinimumRetryCount(t *testing.T) {
	cfg := NewDefaultTargetsItem()
	cfg.RetryCount = 0 - 1

	require.ErrorContains(t, cfg.Validate(), "retry_count value must be greater than or equal to 0")
}

func TestTargetsItemValidate_MaximumRetryCount(t *testing.T) {
	cfg := NewDefaultTargetsItem()
	cfg.RetryCount = 10 + 1

	require.ErrorContains(t, cfg.Validate(), "retry_count value must be less than or equal to 10")
}

func TestTargetsItemValidate_ExclusiveMinimumTimeoutSeconds(t *testing.T) {
	cfg := NewDefaultTargetsItem()
	cfg.TimeoutSeconds = 0

	require.ErrorContains(t, cfg.Validate(), "timeout_seconds value must be greater than 0")
}

func TestTargetsItemValidate_ExclusiveMaximumTimeoutSeconds(t *testing.T) {
	cfg := NewDefaultTargetsItem()
	cfg.TimeoutSeconds = 30

	require.ErrorContains(t, cfg.Validate(), "timeout_seconds value must be less than 30")
}
