mockserver

package
v0.107.1 Latest Latest
Warning

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

Go to latest
Published: Aug 15, 2024 License: Apache-2.0 Imports: 9 Imported by: 0

README

MockServer

This is explicitly a test client for the vcenterreceiver.

It emulates a vCenter server with this Product Information:

      "name": "VMware vCenter Server",
      "fullName": "VMware vCenter Server 7.0.2 build-19272235",
      "vendor": "VMware, Inc.",
      "version": "7.0.2",
      "build": "19272235",
      "localeVersion": "INTL",
      "localeBuild": "000",
      "osType": "linux-x64",
      "productLineId": "vpx",
      "apiType": "VirtualCenter",
      "apiVersion": "7.0.2.0",
      "licenseProductName": "VMware VirtualCenter Server",
      "licenseProductVersion": "7.0"

Method of recording

mitmproxy was used to record the scraper via reverse proxy recording.

The command to run mitmproxy:

mitmproxy -p 55626 --mode=reverse:https://<vcenter-hostname>

And then running the receiver against the proxy.

receivers:
  vcenter:
    endpoint: http://localhost:55626
    username: "otelu"
    password: "otelp"
    tls:
      insecure: false
      insecure_skip_verify: true

service:
  pipelines:
    metrics:
      receivers: [vcenter]

Note govmomi uses cookie based authentication. Because of this the environment variable GOVMOMI_INSECURE_COOKIES=true may need to be set to let the receiver collect.

Documentation

Index

Constants

View Source
const (
	// MockUsername is the correct user for authentication to the Mock Server
	MockUsername = "otelu"
	// MockPassword is the correct password for authentication to the Mock Server
	MockPassword = "otelp"
)

Variables

This section is empty.

Functions

func MockServer

func MockServer(t *testing.T, useTLS bool) *httptest.Server

MockServer has access to recorded SOAP responses and will serve them over http based off the scraper's API calls

Types

This section is empty.

Jump to

Keyboard shortcuts

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