// 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_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 TestConfigValidate_RequiredPort(t *testing.T) {
	cfg := NewDefaultSamplePkg()
	cfg.Port = ""

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

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")
}
