types

package
v1.2.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Feb 5, 2024 License: Apache-2.0 Imports: 1 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	// imported
	AnnotationsExample = test.AnnotationsExample
	ReasonExample      = test.ReasonExample
	ExampleLog         = test.ExampleLog

	MetaExample = FTWOverridesMeta{
		Engine:      "libmodsecurity3",
		Platform:    "nginx",
		Annotations: test.AnnotationsExample,
	}
	TestOverridesExample = []TestOverride{
		{
			RuleId:        920100,
			TestIds:       []int{4, 6},
			Reason:        test.ReasonExample,
			ExpectFailure: func() *bool { b := true; return &b }(),
			Output:        test.ExampleOutput,
		},
	}
)

Functions

This section is empty.

Types

type FTWOverrides

type FTWOverrides struct {
	// description: |
	//   The version field designates the version of the schema that validates this file
	// examples:
	//   - value: "\"v0.1.0\""
	Version string `yaml:"version"`

	// description: |
	//   Meta describes the metadata information
	// examples:
	//   - value: MetaExample
	Meta FTWOverridesMeta `yaml:"meta"`

	// description: |
	//   List of test override specifications
	// examples:
	//   - value: TestOverridesExample
	TestOverrides []TestOverride `yaml:"test_overrides"`
}

FTWOverrides describes platform specific overrides for tests

type FTWOverridesMeta

type FTWOverridesMeta struct {
	// description: |
	//   The name of the WAF engine the tests are expected to run against
	// examples:
	//   - value: "\"coraza\""
	Engine string `yaml:"engine"`

	// description: |
	//   The name of the platform (e.g., web server) the tests are expected to run against
	// examples:
	//   - value: "\"nginx\""
	Platform string `yaml:"platform"`

	// description: |
	//   Custom annotations; can be used to add additional meta information
	// examples:
	//   - value: AnnotationsExample
	Annotations map[string]string `yaml:"annotations"`
}

FTWOverridesMeta describes the metadata information of this yaml file

type TestOverride

type TestOverride struct {
	// description: |
	//   ID of the rule this test targets.
	// examples:
	//   - value: TestOverridesExample[0].RuleId
	RuleId int `yaml:"rule_id"`

	// description: |
	//   IDs of the tests for rule_id that overrides should be applied to.
	//   If this field is not set, the overrides will be applied to all tests of rule_id.
	// examples:
	//   - value: TestOverridesExample[0].TestIds
	TestIds []int `yaml:"test_ids,flow,omitempty"`

	// description: |
	//   Describes why this override is necessary.
	// examples:
	//   - value: ReasonExample
	Reason string `yaml:"reason"`

	// description: |
	//   Whether this test is expected to fail for this particular configuration.
	//   Default: false
	// examples:
	//   - value: true
	ExpectFailure *bool `yaml:"expect_failure,omitempty"`

	// description: |
	//   Whether a stage should be retried once in case of failure.
	//   This option is primarily a workaround for a race condition in phase 5,
	//   where the log entry of a rule may be flushed after the test end marker.
	// examples:
	//   - value: true
	RetryOnce *bool `yaml:"retry_once,omitempty"`

	// description: |
	//   Specifies overrides on the test output
	// examples:
	//   - value: 400
	Output test.Output `yaml:"output"`
}

TestOverride describes overrides for a single test

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL