varnishtest "VCL compiler coverage test: vcc_backend.c"

varnish v1 -errvcl "IPv6 address lacks ']'" {
	backend b1 {
		.host = "[0:0:0:0";
	}
}

varnish v1 -errvcl "IPv6 address has wrong port separator" {
	backend b1 {
		.host = "[0:0:0:0]/0";
	}
}

varnish v1 -errvcl "with exactly three digits" {
	backend b1 {
		.host = "127.0.0.1";
		.probe = {
			.expected_response = 1000;
		}
	}
}

varnish v1 -errvcl "Must specify .threshold with .window" {
	backend b1 {
		.host = "127.0.0.1";
		.probe = {
			.window = 32;
		}
	}
}

varnish v1 -errvcl "Threshold must be 64 or less" {
	backend b1 {
		.host = "127.0.0.1";
		.probe = {
			.threshold = 65;
		}
	}
}

varnish v1 -errvcl "Window must be 64 or less" {
	backend b1 {
		.host = "127.0.0.1";
		.probe = {
			.window = 65;
			.threshold = 64;
		}
	}
}

varnish v1 -errvcl "Threshold can not be greater than window" {
	backend b1 {
		.host = "127.0.0.1";
		.probe = {
			.window = 63;
			.threshold = 64;
		}
	}
}

varnish v1 -errvcl "NB: Backend Syntax has changed:" {
	backend b1 {
		set .host = "127.0.0.1";
	}
}

varnish v1 -errvcl "Expected '{' or name of probe, got" {
	backend b1 {
		.host = "127.0.0.1";
		.probe = "NONE";
	}
}

varnish v1 -errvcl "Field 'port' redefined at:" {
	backend b1 {
		.host = "127.0.0.1";
		.port = "NONE";
		.port = "NONE";
	}
}

varnish v1 -errvcl "Unknown field:" {
	backend b1 {
		.host = "127.0.0.1";
		.fourscoreandsevenyearsago = "NONE";
	}
}

varnish v1 -errvcl "Expected .host or .path." {
	backend b1 {
		.port = "NONE";
	}
}

varnish v1 -errvcl "No default probe defined" {
	backend b1 {
		.probe = default;
	}
}

varnish v1 -errvcl "Only one default director possible." {
	backend b1 { .host = "127.0.0.1"; }
	backend default { .host = "127.0.0.1"; }
	backend default { .host = "127.0.0.1"; }
}

varnish v1 -errvcl "Unused backend b1, defined:" {
	backend b1 { .host = "127.0.0.1"; }
	backend default { .host = "127.0.0.1"; }
}

varnish v1 -errvcl "Address redefinition at:" {
	backend b1 {
		.host = "127.0.0.1";
		.path = "/path/to/uds";
	}
}

varnish v1 -errvcl "Must be an absolute path:" {
	backend b1 {
		.path = "server.sock";
	}
}

shell { rm -f ${tmpdir}/foo }

varnish v1 -errvcl "Cannot stat:" {
	backend b1 {
		.path = "${tmpdir}/foo";
	}
}

varnish v1 -errvcl "Not a socket:" {
	backend b1 {
		.path = "${tmpdir}";
	}
}
