test

package
v1.4.1 Latest Latest
Warning

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

Go to latest
Published: Feb 27, 2024 License: MPL-2.0 Imports: 7 Imported by: 0

Documentation

Index

Constants

View Source
const ManifestJSON = `` /* 2624-byte string literal not displayed */

ManifestJSON is a test manifest.

View Source
const UpdateManifest = `{
	"Packages": {
		"frontend": {
			"SecurityVersion": 5
		}
	}
}`

UpdateManifest is a test update manifest.

View Source
const UserSecrets = `` /* 760-byte string literal not displayed */

UserSecrets is a test JSON string to update secrets.

Variables

View Source
var (

	// RecoveryPublicKey is an automatically generated public key for testing recovery.
	RecoveryPublicKey = recoveryPublicKey
	// RecoveryPrivateKey is an automatically generated private key for testing recovery.
	RecoveryPrivateKey = recoveryPrivateKey
	// AdminCert is an automatically generated test certificate used in unit tests for API features needing additional authentication.
	// The certificate's private key is [RecoveryPrivateKey].
	AdminCert = mustGenerateAdminTestCert(RecoveryPrivateKey)
)
View Source
var IntegrationManifestJSON = `{
	"Packages": {
		"backend": {
			"Debug": true,
			"SecurityVersion": 1,
			"ProductID": 3
		},
		"frontend": {
			"Debug": true,
			"SecurityVersion": 2,
			"ProductID": 3
		}
	},
	"Infrastructures": {
		"Azure": {
			"QESVN": 2,
			"PCESVN": 3,
			"CPUSVN": [0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15],
			"RootCA": [3,3,3]
		}
	},
	"Marbles": {
		"testMarbleServer": {
			"Package": "backend",
			"Parameters": {
				"Files": {
					"/tmp/coordinator_test/defg.txt": "foo",
					"/tmp/coordinator_test/jkl.mno": "bar",
					"/tmp/coordinator_test/secret.raw": "{{ raw .Secrets.symmetricKeyShared }}{{ raw .MarbleRun.MarbleCert.Private }}"
				},
				"Argv": [
					"./marble",
					"serve"
				],
				"Env": {
					"IS_FIRST": "true"
				}
			}
		},
		"testMarbleClient": {
			"Package": "backend",
			"Parameters": {
				"Files": {
					"/tmp/coordinator_test/defg.txt": "foo",
					"/tmp/coordinator_test/jkl.mno": "bar"
				},
				"Env": {
					"IS_FIRST": "true"
				}
			}
		},
		"testMarbleUnset": {
			"Package": "backend",
			"Parameters": {
				"Files": {
					"/tmp/coordinator_test/defg.txt": "foo",
					"/tmp/coordinator_test/jkl.mno": "bar",
					"/tmp/coordinator_test/pqr.txt": "user-defined secret: {{ raw .Secrets.symmetricKeyUnset }} {{ pem .Secrets.certUnset.Private }}"
				},
				"Env": {
					"IS_FIRST": "true"
				}
			}
		},
		"badMarble": {
			"Package": "frontend",
			"Parameters": {
				"Files": {
					"/tmp/coordinator_test/defg.txt": "foo",
					"/tmp/coordinator_test/jkl.mno": "bar"
				}
			}
		}
	},
	"Secrets" :{
		"symmetricKeyShared": {
			"Size": 128,
			"Shared": true,
			"Type": "symmetric-key"
		},
		"symmetricKeyUnset": {
			"Shared": true,
			"Type": "symmetric-key",
			"Size": 128,
			"UserDefined": true
		},
		"certUnset": {
			"Shared": true,
			"Type": "cert-ed25519",
			"UserDefined": true
		}
	},
	"Users": {
		"admin": {
			"Certificate": "` + pemToJSONString(AdminCert) + `",
			"Roles": [
				"writeRole",
				"readRole",
				"updateRole"
			]
		}
	},
	"RecoveryKeys": {
		"testRecKey1": "` + pemToJSONString(RecoveryPublicKey) + `"
	},
	"Roles": {
		"writeRole": {
			"ResourceType": "Secrets",
			"ResourceNames": [
				"symmetricKeyUnset",
				"certUnset"
			],
			"Actions": [
				"WriteSecret"
			]
		},
		"readRole": {
			"ResourceType": "Secrets",
			"ResourceNames": [
				"symmetricKeyShared"
			],
			"Actions": [
				"ReadSecret"
			]
		},
		"updateRole": {
			"ResourceType": "Packages",
			"ResourceNames": [
				"frontend",
				"backend"
			],
			"Actions": [
				"UpdateSecurityVersion"
			]
		}
	}
}`

IntegrationManifestJSON is a test manifest.

View Source
var ManifestJSONMissingParameters = `` /* 398-byte string literal not displayed */

ManifestJSONMissingParameters is a test manifest.

View Source
var ManifestJSONWithRecoveryKey = `{
	"Packages": {
		"frontend": {
			"SignerID": "1f1e1d1c1b1a191817161514131211100f0e0d0c0b0a09080706050403020100",
			"ProductID": 44,
			"SecurityVersion": 3,
			"Debug": true
		}
	},
	"Infrastructures": {
		"Azure": {
			"QESVN": 2,
			"PCESVN": 3,
			"CPUSVN": [0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15],
			"RootCA": [3,3,3]
		}
	},
	"Marbles": {
		"frontend": {
			"Package": "frontend"
		},
		"envMarble": {
			"Package": "frontend",
			"Parameters": {
				"Env": {
					"ENV_SECRET": "{{ string .Secrets.genericSecret }}"
				}
			}
		}
	},
	"Secrets": {
		"restrictedSecret": {
			"Size": 128,
			"Shared": true,
			"Type": "symmetric-key"
		},
		"symmetricKeyShared": {
			"Size": 128,
			"Shared": true,
			"Type": "symmetric-key"
		},
		"symmetricKeyPrivate": {
			"Size": 256,
			"Type": "symmetric-key"
		},
		"certPrivate": {
			"Size": 2048,
			"Type": "cert-rsa",
			"Cert": {
				"Subject": {
					"CommonName": "MarbleRun Unit Test Private"
				}
			},
			"ValidFor": 7
		},
		"certShared": {
			"Shared": true,
			"Type": "cert-ed25519",
			"Cert": {
				"Subject": {
					"CommonName": "MarbleRun Unit Test Shared"
				}
			},
			"ValidFor": 7
		},
		"symmetricKeyUnset": {
			"Type": "symmetric-key",
			"Size": 128,
			"UserDefined": true
		},
		"certUnset": {
			"Type": "cert-ed25519",
			"UserDefined": true
		},
		"genericSecret": {
			"UserDefined": true,
			"Type": "plain"
		}
	},
	"Users": {
		"admin": {
			"Certificate": "` + pemToJSONString(AdminCert) + `",
			"Roles": [
				"secretManager",
				"readOnly",
				"updateManager"
			]
		}
	},
	"RecoveryKeys": {
		"testRecKey1": "` + pemToJSONString(RecoveryPublicKey) + `"
	},
	"Roles": {
		"secretManager": {
			"ResourceType": "Secrets",
			"ResourceNames": [
				"symmetricKeyUnset",
				"certUnset",
				"genericSecret"
			],
			"Actions": [
				"ReadSecret",
				"WriteSecret"
			]
		},
		"readOnly": {
			"ResourceType": "Secrets",
			"ResourceNames": [
				"symmetricKeyShared",
				"certShared"
			],
			"Actions": [
				"ReadSecret"
			]
		},
		"updateManager": {
			"ResourceType": "Packages",
			"ResourceNames": [
				"frontend"
			],
			"Actions": [
				"UpdateSecurityVersion"
			]
		}
	}
}`

ManifestJSONWithRecoveryKey is a test manifest with a dynamically generated RSA key.

Functions

func MustSetupTestCerts added in v0.3.0

func MustSetupTestCerts(key *rsa.PrivateKey) (*x509.Certificate, *x509.Certificate)

MustSetupTestCerts can be used by other unit tests to test authentication features, in which one certificate matches the generated admin certificate, and the other is just a randomly generated one.

Types

This section is empty.

Directories

Path Synopsis
Package framework provides a testing framework for MarbleRun integration testing.
Package framework provides a testing framework for MarbleRun integration testing.

Jump to

Keyboard shortcuts

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