Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 7 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -227,6 +227,13 @@ update-env-yaml: ## Update config/manager/env.yaml with image variables if provi
sed -i '/- name: LINUXPTP_DAEMON_IMAGE$$/,/value:/s|value: ".*"|value: "$(LINUXPTP_DAEMON_IMAGE)"|' config/manager/env.yaml; \
fi; \
fi; \
if [ -n "$(KUBE_RBAC_PROXY_IMAGE)" ]; then \
if [ "$(OS)" = "Darwin" ]; then \
sed -i '' '/- name: KUBE_RBAC_PROXY_IMAGE$$/,/value:/s|value: ".*"|value: "$(KUBE_RBAC_PROXY_IMAGE)"|' config/manager/env.yaml; \
else \
sed -i '/- name: KUBE_RBAC_PROXY_IMAGE$$/,/value:/s|value: ".*"|value: "$(KUBE_RBAC_PROXY_IMAGE)"|' config/manager/env.yaml; \
fi; \
fi; \
if [ -n "$(SIDECAR_EVENT_IMAGE)" ]; then \
if [ "$(OS)" = "Darwin" ]; then \
sed -i '' '/- name: SIDECAR_EVENT_IMAGE$$/,/value:/s|value: ".*"|value: "$(SIDECAR_EVENT_IMAGE)"|' config/manager/env.yaml; \
Expand Down
5 changes: 3 additions & 2 deletions test/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,10 +12,11 @@ To run the conformance tests, first set the following environment variables:
- **PTP_TEST_MODE**: this is the desired mode to run the tests. Choose between: Discovery, OC and BC. See below for an explanation for each mode.
- **DISCOVERY_MODE**: This is a legacy option and is equivalent to setting "Discovery" option in the PTP_TEST_MODE environment variable
- **ENABLE_TEST_CASE**: This is an option to run the long running tests separated by comma. For example, to run reboot test, `ENABLE_TEST_CASE=reboot` shall be used.
- **SKIP_INTERFACES**: passes a list of interfaces to be skipped in the form "eno1,ens2f1" `SKIP_INTERFACES="eno1,ens2f1"`
- **SKIP_INTERFACES**: passes a list of interfaces to be skipped in the form "eno1,ens2f1" `SKIP_INTERFACES="eno1,ens2f1"`. These interfaces are excluded from L2 discovery and any solver solutions containing them are also discarded.
- **KEEP_PTPCONFIG**: if set to true, the test script will not delete the ptpconfig it automatically created. If set to false, it will delete them. The ptpconfigs are deleted by default. For instance `KEEP_PTPCONFIG=true`
- **MAX_OFFSET_IN_NS**: maximum offset in nanoseconds between a master and a slave clock when testing clock accuracy. Default is 100
- **MAX_OFFSET_IN_NS**: maximum offset in nanoseconds between a master and a slave clock when testing clock accuracy. Also used as LocalMaxHoldoverOffset for E810 plugin. Default is 100
- **MIN_OFFSET_IN_NS**: minimum offset in nanoseconds between a master and a slave clock when testing clock accuracy. Default is -100
- **MAX_IN_SPEC_OFFSET_NS**: maximum in-spec offset in nanoseconds for E810 plugin holdover specification threshold. Default is 100
- **ENABLE_PTP_EVENT**: enable event based tests.
- **EVENT_API_VERSION**: passes the default REST-API version for the event based tests. Set this to "2.0" for 4.16+ PUT, "1.0" for 4.15 and earlier. If this is not set, default value "2.0" is used.
- **ENABLE_V1_REGRESSION**: enable V1 regression for event based tests. For 4.16 and 4.17, event based tests will be repeated the second time with v1 REST-API. These tests are marked with "v1 regression".
Expand Down
437 changes: 424 additions & 13 deletions test/conformance/serial/ptp.go

Large diffs are not rendered by default.

3 changes: 2 additions & 1 deletion test/pkg/clean/clean.go
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,8 @@ func Configs() {
ptpConfig.Name == pkg.PtpSlave2PolicyName ||
ptpConfig.Name == pkg.PtpTempPolicyName ||
ptpConfig.Name == pkg.PtpDualNicBCHAPolicyName ||
ptpConfig.Name == pkg.PtpVolumeMountCleanPolicyName {
ptpConfig.Name == pkg.PtpVolumeMountCleanPolicyName ||
ptpConfig.Name == pkg.PTPWPCTBCPolicyName {
err = client.Client.PtpConfigs(pkg.PtpLinuxDaemonNamespace).Delete(context.Background(), ptpConfig.Name, metav1.DeleteOptions{})
if err != nil {
logrus.Infof("clean.All: Failed to delete ptp config %s %v", ptpConfig.Name, err)
Expand Down
18 changes: 10 additions & 8 deletions test/pkg/consts.go
Original file line number Diff line number Diff line change
Expand Up @@ -21,14 +21,16 @@ const (
EventProxyContainerName = "cloud-event-proxy"

// policy name
PtpGrandMasterPolicyName = "test-grandmaster"
PtpWPCGrandMasterPolicyName = "test-wpc-grandmaster"
PtpBcMaster1PolicyName = "test-bc-master1"
PtpSlave1PolicyName = "test-slave1"
PtpBcMaster2PolicyName = "test-bc-master2"
PtpSlave2PolicyName = "test-slave2"
PtpDualNicBCHAPolicyName = "test-dual-nic-bc-ha"
PtpTempPolicyName = "temp"
PtpGrandMasterPolicyName = "test-grandmaster"
PtpWPCGrandMasterPolicyName = "test-wpc-grandmaster"
PtpBcMaster1PolicyName = "test-bc-master1"
PtpSlave1PolicyName = "test-slave1"
PtpBcMaster2PolicyName = "test-bc-master2"
PtpSlave2PolicyName = "test-slave2"
PTPWPCTBCPolicyName = "test-wpc-tbc"
PtpDualNicBCHAPolicyName = "test-dual-nic-bc-ha"
PtpTempPolicyName = "temp"

PtpUnderscoreTestPolicyName = "test-underscore-profile"
PtpVolumeMountCleanPolicyName = "test-volume-mount-cleanup"

Expand Down
13 changes: 7 additions & 6 deletions test/pkg/logging/collector.go
Original file line number Diff line number Diff line change
Expand Up @@ -98,12 +98,6 @@ func ShouldWriteTestMarkers() bool {
return value == "true" || value == "1"
}

func WriteStep(step string) {
if collector != nil && ShouldWriteTestMarkers() {
collector.writers.writeToAll(createStepMarker(step))
}
}

func GetLogArtifactsDir() string {
if dir := os.Getenv("LOG_ARTIFACTS_DIR"); dir != "" {
return dir
Expand Down Expand Up @@ -243,6 +237,13 @@ func WriteTestEnd(report ginkgo.SpecReport) {
}
}

// WriteStep writes a test step marker to all pod log files
func WriteStep(step string) {
if collector != nil && ShouldWriteTestMarkers() {
collector.writers.writeToAll(createStepMarker(step))
}
}

// ============================================================================
// File Writer - One goroutine per file
// ============================================================================
Expand Down
3 changes: 3 additions & 0 deletions test/pkg/metrics/metrics.go
Original file line number Diff line number Diff line change
Expand Up @@ -29,10 +29,12 @@ const (
metricsEndPoint = "127.0.0.1:9091/metrics"
MaxOffsetDefaultNs = 100
MinOffsetDefaultNs = -100
MaxInSpecOffsetDefaultNs = 100
)

var MaxOffsetNs int
var MinOffsetNs int
var MaxInSpecOffsetNs int

// type and display for OpenshiftPtpInterfaceRole metric. Values: 0 = PASSIVE, 1 = SLAVE, 2 = MASTER, 3 = FAULTY, 4 = UNKNOWN
type MetricRole int
Expand Down Expand Up @@ -222,6 +224,7 @@ func getMetric(nodeName, aIf, metricName string) (metric string, err error) {
}
}

// Metric not found — collect available lines for this metric name to include in error
for _, line := range strings.Split(metrics, "\n") {
if strings.HasPrefix(line, metricName+"{") {
availableLines = append(availableLines, line)
Expand Down
Loading
Loading