webconnectivityqa

package
v3.21.0-alpha Latest Latest
Warning

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

Go to latest
Published: Mar 25, 2024 License: GPL-3.0 Imports: 19 Imported by: 0

Documentation

Overview

Package webconnectivityqa contains code to perform Web Connectivity QA. This package is separate from [webconnectivity] and [webconnectivitylte] and works with both.

Index

Constants

View Source
const (
	// TestCaseFlagNoV04 means that this test case should not be run by v0.4
	TestCaseFlagNoV04 = 1 << iota

	// TestCaseFlagNoLTE means that this test case should not be run by LTE
	TestCaseFlagNoLTE
)

Variables

View Source
var ErrCheckerInvalidClientResolver = errors.New("invalid client_resolver field")

ErrCheckerInvalidClientResolver indicates that the client_resolver field is invalid.

View Source
var ErrCheckerNoReadWriteEvents = errors.New("no read or write events")

ErrCheckerNoReadWriteEvents indicates that a checker did not find any read/write events.

View Source
var ErrCheckerUnexpectedWebConnectivityVersion = errors.New("unexpected Web Connectivity version")

ErrCheckerUnexpectedWebConnectivityVersion indicates that the version is unexpected

Functions

func MeasureTestCase

func MeasureTestCase(measurer model.ExperimentMeasurer, tc *TestCase) (*model.Measurement, error)

MeasureTestCase returns the JSON measurement produced by a TestCase.

func RunTestCase

func RunTestCase(measurer model.ExperimentMeasurer, tc *TestCase) error

RunTestCase runs a [testCase].

Types

type Checker

type Checker interface {
	Check(mx *model.Measurement) error
}

Checker checks whether a measurement is correct.

type ClientResolverCorrectnessChecker

type ClientResolverCorrectnessChecker struct{}

ClientResolverCorrectnessChecker checks whether the client_resolver field inside of the test_keys has been correctly configured.

func (*ClientResolverCorrectnessChecker) Check

Check implements Checker.

type ReadWriteEventsExistentialChecker

type ReadWriteEventsExistentialChecker struct{}

ReadWriteEventsExistentialChecker fails if there are zero network events.

func (*ReadWriteEventsExistentialChecker) Check

Check implements Checker.

type TestCase

type TestCase struct {
	// Name is the test case name
	Name string

	// Flags contains binary flags describing this test case.
	Flags int64

	// Input is the input URL
	Input string

	// LongTest indicates that this is a long test.
	LongTest bool

	// Configure is an OPTIONAL hook for further configuring the scenario.
	Configure func(env *netemx.QAEnv)

	// ExpectErr is true if we expected an error
	ExpectErr bool

	// ExpectTestKeys contains the expected test keys
	ExpectTestKeys *TestKeys

	// Checkers contains an OPTIONAL list of checkers
	// that perform additional parsing of the measurement
	// to ensure that specific properties hold.
	Checkers []Checker
}

TestCase is a test case we could run with this package.

func AllTestCases

func AllTestCases() []*TestCase

AllTestCases returns all the defined test cases.

type TestKeys

type TestKeys struct {
	// XExperimentVersion is the experiment version.
	XExperimentVersion string `json:"x_experiment_version"`

	// DNSExperimentFailure contains the failure occurre during the DNS experiment.
	DNSExperimentFailure any `json:"dns_experiment_failure"`

	// DNSConsistency is either "consistent" or "inconsistent" and indicates whether the IP addresses
	// returned by the probe match those returned by the TH. When the probe DNS lookup fails and the
	// TH lookup succeeds (or the other way around) the DNSConsistency should be "inconsistent".
	DNSConsistency any `json:"dns_consistency"`

	// ControlFailure indicates whether the control connection failed.
	ControlFailure any `json:"control_failure"`

	// HTTPExperimentFailure indicates whether the HTTP experiment failed.
	HTTPExperimentFailure any `json:"http_experiment_failure"`

	// These keys indicate whether the HTTP body returned by the TH matches the probe's body.
	BodyLengthMatch any     `json:"body_length_match"`
	BodyProportion  float64 `json:"body_proportion"`
	StatusCodeMatch any     `json:"status_code_match"`
	HeadersMatch    any     `json:"headers_match"`
	TitleMatch      any     `json:"title_match"`

	// XStatus summarizes the result of the analysis performed by WebConnectivity v0.4.
	XStatus int64 `json:"x_status"`

	// These flags summarize the result of the analysis performed by WebConnectivity LTE.
	XDNSFlags      int64 `json:"x_dns_flags"`
	XBlockingFlags int64 `json:"x_blocking_flags"`
	XNullNullFlags int64 `json:"x_null_null_flags"`

	// Accessible indicates whether the URL was accessible.
	Accessible any `json:"accessible"`

	// Blocking is either nil or a string classifying the blocking type.
	Blocking any `json:"blocking"`
}

TestKeys is the test keys structure returned by this package.

Jump to

Keyboard shortcuts

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