notwork

package module
v1.2.1 Latest Latest
Warning

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

Go to latest
Published: Apr 8, 2023 License: Apache-2.0 Imports: 0 Imported by: 0

README

notwork

PkgGoDev GitHub build and test Go Report Card Coverage

A tiny package to help with creating transient Linux virtual network elements for testing purposes. It leverages both the Ginkgo testing framework and matching (erm, sic!) Gomega matchers.

Make Targets

  • make: lists all targets.
  • make coverage: runs all tests with coverage and then updates the coverage badge in README.md.
  • make pkgsite: installs x/pkgsite, as well as the browser-sync and nodemon npm packages first, if not already done so. Then runs the pkgsite and hot reloads it whenever the documentation changes.
  • make report: installs @gojp/goreportcard if not yet done so and then runs it on the code base.
  • make test: runs all tests (as root), always.
  • make vuln: installs x/vuln/cmd/govulncheck and then runs it.

Copyright 2023 Harald Albrecht, licensed under the Apache License, Version 2.0.

Documentation

Overview

Package notwork helps unit tests to create transient virtual network interfaces. It leverages both the Ginkgo testing framework and matchting (erm, sic!) Gomega matchers.

Usage

To create a transient MACVLAN network interface with a dummy-type parent network interface for the duration of a test (node):

import (
    "github.com/thediveo/notwork/dummy"
    "github.com/thediveo/notwork/macvlan"

    . "github.com/onsi/ginkgo/v2"
    . "github.com/onsi/gomega"
)

var _ = Describe("some testing", func() {

    It("creates a transient MACVLAN with a dummy parent", func() {
        mcvlan := macvlan.NewTransient(dummy.NewTransient())
    })

})

The MACVLAN and dummy network interfaces will automatically removed at the end of the test (node) they are created in, regardless of success or failure.

If creating the virtual network interfaces fails, the test will immediately fail.

Disclaimer

This module suffers from overzealous sub-packaging.

Directories

Path Synopsis
Package dummy helps with creating transient [dummy] type virtual network interfaces for testing purposes.
Package dummy helps with creating transient [dummy] type virtual network interfaces for testing purposes.
Package link helps with creating transient type virtual network interfaces of various types for testing purposes.
Package link helps with creating transient type virtual network interfaces of various types for testing purposes.
Package macvlan helps with creating transient MACVLAN network interfaces for testing purposes.
Package macvlan helps with creating transient MACVLAN network interfaces for testing purposes.
Package netns supports running unit tests in separated transient network namespaces.
Package netns supports running unit tests in separated transient network namespaces.

Jump to

Keyboard shortcuts

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