aeintegrate

package
v0.0.0-...-3be5551 Latest Latest
Warning

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

Go to latest
Published: Apr 3, 2018 License: Apache-2.0 Imports: 13 Imported by: 0

Documentation

Overview

Package aeintegrate facilitates end-to-end testing against the production Google App Engine.

This is a specialized tool that could be used in addition to unit tests. It calls the `gcloud app` command directly.

gcloud(https://cloud.google.com/sdk) must be installed. You must be authorized via the gcloud command-line tool (`gcloud auth login`).

You may specify the location of gcloud via the GCLOUD_BIN environment variable.

Sample usage with `go test`:

package myapp

import (
	"testing"
	"google.golang.org/appengine/aeintegrate"
)

func TestApp(t *testing.T) {
	t.Parallel()
	app := aeintegrate.App{Name: "A", Dir: "app"},
	if err := app.Deploy(); err != nil {
		t.Fatalf("could not deploy app: %v", err)
	}
	defer app.Cleanup()
	resp, err := app.Get("/")
	...
}

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type App

type App struct {
	// Name is an ID, used for logging and to generate a unique version to this run.
	Name string

	// The root directory containing the app's source code.
	Dir string

	// The configuration (app.yaml) file, relative to Dir. Defaults to "app.yaml".
	AppYaml string

	// The project to deploy to.
	ProjectID string

	// The service/module to deploy to. Read only.
	Service string

	// Additional runtime environment variable overrides for the app.
	Env map[string]string
	// contains filtered or unexported fields
}

App describes an App Engine application.

func (*App) Cleanup

func (p *App) Cleanup() error

Cleanup deletes the created version from App Engine.

func (*App) Deploy

func (p *App) Deploy() error

Deploy deploys the application to App Engine. If the deployment fails, it tries to clean up the failed deployment.

func (*App) Deployed

func (p *App) Deployed() bool

Deployed reports whether the application has been deployed.

func (*App) Get

func (p *App) Get(path string) (*http.Response, error)

Get issues a GET request against the base URL of the deployed application.

func (*App) URL

func (p *App) URL(path string) (string, error)

URL prepends the deployed application's base URL to the given path. Returns an error if the application has not been deployed.

Jump to

Keyboard shortcuts

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