Fix typos

Change-Id: I0ce87ec00d2b5974cf861d9c9685f23d7d0f5fc1
Signed-off-by: Ruslan Aliev <raliev@mirantis.com>
This commit is contained in:
Ruslan Aliev 2020-09-21 02:49:33 -05:00
parent 27e0ab455c
commit 2e85043c20
27 changed files with 66 additions and 66 deletions

View File

@ -22,7 +22,7 @@ import (
)
const (
// TODO (kkalynovskyi) when different phase executors will be implmeneted, and their description is more clear,
// TODO (kkalynovskyi) when different phase executors will be implemented, and their description is more clear,
// add documentation here. also consider adding dynamic phase descriptions based on executors.
// TODO (kkalynovskyi) when this command is fully functional and phase executors are developed
// remove phase apply command

View File

@ -53,7 +53,7 @@ type Provider struct {
// ignored if IsClusterctlRepository is set to true
Versions map[string]string `json:"versions,omitempty"`
// VariableSubstitution indicates weather you want to substitute variales in the cluster-api manifests
// VariableSubstitution indicates weather you want to substitute variables in the cluster-api manifests
// if set to true, variables will be substituted only if they are defined either in Environment or
// in AdditionalComponentVariables, if not they will be left as is.
VariableSubstitution bool `json:"variable-substitution,omitempty"`

View File

@ -28,7 +28,7 @@ type Phase struct {
Config PhaseConfig `json:"config,omitempty"`
}
// PhaseConfig represents configuration for a particular phase. It contins a reference to
// PhaseConfig represents configuration for a particular phase. It contains a reference to
// phase runner object which should contain runner configuration
type PhaseConfig struct {
ExecutorRef *corev1.ObjectReference `json:"executorRef"`

View File

@ -102,7 +102,7 @@ func TestExecutorRun(t *testing.T) {
expectedEvt []events.Event
}{
{
name: "Run isogen successefully",
name: "Run isogen successfully",
builder: &mockContainer{
runCommand: func() error { return nil },
getID: func() string { return "TESTID" },

View File

@ -26,7 +26,7 @@ func (err ErrInvalidStatusCheck) Error() string {
return fmt.Sprintf("invalid status-check: %s", err.What)
}
// ErrResourceNotFound is used when a resource is requrested from a StatusMap,
// ErrResourceNotFound is used when a resource is requested from a StatusMap,
// but that resource can't be found
type ErrResourceNotFound struct {
Resource string

View File

@ -76,7 +76,7 @@ func (c *Client) Init(kubeconfigPath, kubeconfigContext string) error {
// newConfig returns clusterctl config client
func newConfig(options *airshipv1.Clusterctl, root string) (clusterctlconfig.Client, error) {
for _, provider := range options.Providers {
// this is a workaround as cluserctl validates if URL is empty, even though it is not
// this is a workaround as clusterctl validates if URL is empty, even though it is not
// used anywhere outside repository factory which we override
// TODO (kkalynovskyi) we need to create issue for this in clusterctl, and remove URL
// validation and move it to be an error during repository interface initialization

View File

@ -77,7 +77,7 @@ func (f RepositoryFactory) repoFactory(provider config.Provider) (repository.Cli
}
// inject repository into repository client
o := repository.InjectRepository(repo)
log.Printf("Creating arishipctl repository implementation interface for provider %s of type %s\n",
log.Printf("Creating airshipctl repository implementation interface for provider %s of type %s\n",
name,
repoType)

View File

@ -156,7 +156,7 @@ func pauseUnpauseBMHs(ctx context.Context, crClient client.Client, namespace str
return nil
}
// getBMHs will return all BareMetalHost objects in the specified namepace.
// getBMHs will return all BareMetalHost objects in the specified namespace.
// It also checks to see if the BareMetalHost resource is installed, if not,
// it will return false.
func getBMHs(ctx context.Context, crClient client.Client, namespace string) (bmh.BareMetalHostList, error) {

View File

@ -36,14 +36,14 @@ func TestNewCommand(t *testing.T) {
require.NoError(t, err)
tests := []struct {
name string
expectErr bool
currentConext string
manifests map[string]*config.Manifest
name string
expectErr bool
currentContext string
manifests map[string]*config.Manifest
}{
{
name: "default success",
currentConext: validContext,
name: "default success",
currentContext: validContext,
manifests: map[string]*config.Manifest{
manifestName: {
TargetPath: "testdata",
@ -56,9 +56,9 @@ func TestNewCommand(t *testing.T) {
},
},
{
name: "Bundle build failure",
currentConext: validContext,
expectErr: true,
name: "Bundle build failure",
currentContext: validContext,
expectErr: true,
manifests: map[string]*config.Manifest{
manifestName: {
TargetPath: "testdata",
@ -71,9 +71,9 @@ func TestNewCommand(t *testing.T) {
},
},
{
name: "invalid clusterctl kind",
currentConext: validContext,
expectErr: true,
name: "invalid clusterctl kind",
currentContext: validContext,
expectErr: true,
manifests: map[string]*config.Manifest{
manifestName: {
TargetPath: "testdata",
@ -95,9 +95,9 @@ func TestNewCommand(t *testing.T) {
},
},
{
name: "cant find context",
currentConext: "invalid-context",
expectErr: true,
name: "cant find context",
currentContext: "invalid-context",
expectErr: true,
manifests: map[string]*config.Manifest{
manifestName: {
TargetPath: "testdata",
@ -114,7 +114,7 @@ func TestNewCommand(t *testing.T) {
expectErr := tt.expectErr
manifests := tt.manifests
cfg.Manifests = manifests
context := tt.currentConext
context := tt.currentContext
t.Run(tt.name, func(t *testing.T) {
cfg.Manifests = manifests
cfg.CurrentContext = context

View File

@ -95,12 +95,12 @@ func allowFromEnv(key string) bool {
}
func allowAppend(key, _ string) bool {
// TODO Investigate if more vaildation should be done here
forbidenVars := map[string]string{
// TODO Investigate if more validation should be done here
forbiddenVars := map[string]string{
config.ProvidersConfigKey: "",
imagesConfigKey: "",
}
_, forbid := forbidenVars[key]
_, forbid := forbiddenVars[key]
log.Debugf("Verifying that variable %s is allowed to be appended", key)
return !forbid
}

View File

@ -72,7 +72,7 @@ func TestMissingVariableRepoClient(t *testing.T) {
assert.Nil(t, c)
}
func TestEnvVariableSubstiutionRepoClient(t *testing.T) {
func TestEnvVariableSubstitutionRepoClient(t *testing.T) {
airRepoClient := testRepoClient(testRepoOpts{
kustRoot: "functions/5",
envVars: true,
@ -114,7 +114,7 @@ func TestEnvVariableSubstiutionRepoClient(t *testing.T) {
// are not. Clusterctl behavior doesn't allow to skip variable substitution completely
// instead if SkipVariables is set to True, it will not throw errors if these variables
// are not set in config reader.
func TestAdditionalVariableSubstiutionRepoClient(t *testing.T) {
func TestAdditionalVariableSubstitutionRepoClient(t *testing.T) {
vars := map[string]string{
"AZURE_SUBSCRIPTION_ID_B64": "c29tZS1iYXNlNjQtSUQtdGV4dAo=",
"AZURE_TENANT_ID_B64": "c29tZS1iYXNlNjQtVEVOQU5ULUlELXRleHQK",

View File

@ -208,10 +208,10 @@ func TestGetFile(t *testing.T) {
} else {
assert.NoError(t, err)
if fileToUse == "metadata.yaml" {
gotMetdata := metadata(t, b)
gotMetadata := metadata(t, b)
parsedVersion, err := versionclient.ParseSemantic(versionToUse)
require.NoError(t, err)
assert.Equal(t, resultContract, gotMetdata.GetReleaseSeriesForVersion(parsedVersion).Contract)
assert.Equal(t, resultContract, gotMetadata.GetReleaseSeriesForVersion(parsedVersion).Contract)
} else {
gotVersion := version(t, b)
assert.Equal(t, resultVersion, gotVersion.Spec.Version)

View File

@ -405,7 +405,7 @@ func (c *Config) ModifyContext(context *Context, theContext *ContextOptions) {
}
// GetCurrentContext methods Returns the appropriate information for the current context
// Current Context holds labels for the approriate config objects
// Current Context holds labels for the appropriate config objects
// ClusterType is the name of the clustertype for this context, it should be a flag we pass to it??
// Manifest is the default manifest to be use with this context
// Purpose for this method is simplifying the current context information

View File

@ -29,9 +29,9 @@ type ErrIncompatibleAuthOptions struct {
AuthType string
}
// NewErrIncompetibleAuthOptions returns Error of type
// NewErrIncompatibleAuthOptions returns Error of type
// ErrIncompatibleAuthOptions
func NewErrIncompetibleAuthOptions(fo []string, ao string) error {
func NewErrIncompatibleAuthOptions(fo []string, ao string) error {
return ErrIncompatibleAuthOptions{
ForbiddenOptions: fo,
AuthType: ao,

View File

@ -137,15 +137,15 @@ func (auth *RepoAuth) Validate() error {
switch auth.Type {
case SSHAuth:
if auth.HTTPPassword != "" || auth.SSHPassword != "" {
return NewErrIncompetibleAuthOptions([]string{"http-pass, ssh-pass"}, auth.Type)
return NewErrIncompatibleAuthOptions([]string{"http-pass, ssh-pass"}, auth.Type)
}
case HTTPBasic:
if auth.SSHPassword != "" || auth.KeyPath != "" || auth.KeyPassword != "" {
return NewErrIncompetibleAuthOptions([]string{"ssh-pass, ssh-key, key-pass"}, auth.Type)
return NewErrIncompatibleAuthOptions([]string{"ssh-pass, ssh-key, key-pass"}, auth.Type)
}
case SSHPass:
if auth.KeyPath != "" || auth.KeyPassword != "" || auth.HTTPPassword != "" {
return NewErrIncompetibleAuthOptions([]string{"ssh-key, key-pass, http-pass"}, auth.Type)
return NewErrIncompatibleAuthOptions([]string{"ssh-key, key-pass, http-pass"}, auth.Type)
}
}
return nil

View File

@ -164,13 +164,13 @@ func TestDocument(t *testing.T) {
docs, err := bundle.GetAllDocuments()
require.NoError(err, "Unexpected error trying to GetAllDocuments")
annotationMap := map[string]string{
"test-annotation": "test-annotaiton-value",
"test-annotation": "test-annotation-value",
}
for _, doc := range docs {
doc.Annotate(annotationMap)
annotationList := doc.GetAnnotations()
assert.Equal(annotationList["test-annotation"], "test-annotaiton-value")
assert.Equal(annotationList["test-annotation"], "test-annotation-value")
}
})
@ -268,7 +268,7 @@ stringData:
expectedDocName: "control-0-bmc",
},
{
name: "Manformed Bytes",
name: "Malformed Bytes",
stringData: `
broken:fas -<
fasd`,

View File

@ -45,9 +45,9 @@ spec:
{
pluginCfg: []byte(`---
apiVersion: airshipit.org/v1alpha1
kind: BareMetalGenereator
kind: BareMetalGenerator
spec: -
someField: someValu`),
someField: someValue`),
expectedError: "error converting YAML to JSON: yaml: line 4: block sequence entries are not allowed in this context",
},
}

View File

@ -44,7 +44,7 @@ func (s Selector) ByName(name string) Selector {
return s
}
// ByNamespace select by namepace
// ByNamespace select by namespace
func (s Selector) ByNamespace(namespace string) Selector {
s.Namespace = namespace
return s

View File

@ -77,7 +77,7 @@ type IsogenOperation int
const (
// IsogenStart operation
IsogenStart IsogenOperation = iota
// IsogenValidation opearation
// IsogenValidation operation
IsogenValidation
// IsogenEnd operation
IsogenEnd

View File

@ -45,7 +45,7 @@ const (
DefaultNamespace = "airshipit"
)
// Applier delivers documents to kubernetes in a declerative way
// Applier delivers documents to kubernetes in a declarative way
type Applier struct {
Driver Driver
Factory cmdutil.Factory
@ -101,20 +101,20 @@ func (a *Applier) getInfos(bundleName string, bundle document.Bundle) ([]*resour
ByKind(document.ConfigMapKind)
// if we could find exactly one inventory document, we don't do anything else with it
_, err := bundle.SelectOne(selector)
// if we got an error, which means we could not find Config Map with invetory ID at rest
// if we got an error, which means we could not find Config Map with inventory ID at rest
// now we need to generate and inject one at runtime
if err != nil && errors.As(err, &document.ErrDocNotFound{}) {
log.Debug("Inventory Object config Map not found, auto generating Invetory object")
log.Debug("Inventory Object config Map not found, auto generating Inventory object")
invDoc, innerErr := NewInventoryDocument(bundleName)
if innerErr != nil {
// this should never happen
log.Debug("Failed to create new invetory document")
log.Debug("Failed to create new inventory document")
return nil, innerErr
}
log.Debugf("Injecting Invetory Object: %v into bundle", invDoc)
log.Debugf("Injecting Inventory Object: %v into bundle", invDoc)
innerErr = bundle.Append(invDoc)
if innerErr != nil {
log.Debug("Couldn't append bunlde with inventory document")
log.Debug("Couldn't append bundle with inventory document")
return nil, innerErr
}
log.Debugf("Making sure that inventory object namespace %s exists", invDoc.GetNamespace())
@ -180,7 +180,7 @@ type Adaptor struct {
Factory cmdutil.Factory
}
// Initialize sets fake required command line flags for underlaying cli-utils package
// Initialize sets fake required command line flags for underlying cli-utils package
func (a *Adaptor) Initialize(p poller.Poller) error {
cmd := &cobra.Command{}
// Code below is copied from cli-utils package and used the same way as in upstream:
@ -215,7 +215,7 @@ func (a *Adaptor) Run(ctx context.Context, infos []*resource.Info, options cliap
return a.CliUtilsApplier.Run(ctx, infos, options)
}
// NewInventoryDocument returns default config map with invetory Id to group up the objects
// NewInventoryDocument returns default config map with inventory Id to group up the objects
func NewInventoryDocument(inventoryID string) (document.Document, error) {
cm := v1.ConfigMap{
TypeMeta: metav1.TypeMeta{
@ -224,7 +224,7 @@ func NewInventoryDocument(inventoryID string) (document.Document, error) {
},
ObjectMeta: metav1.ObjectMeta{
// name here is a dummy name, cli utils won't use this name, this config map simply parsed
// for invetory ID from label, and then ignores this config map
// for inventory ID from label, and then ignores this config map
Name: fmt.Sprintf("%s-%s", "airshipit", inventoryID),
// TODO this limits us to single namespace. research passing this as parameter from
// somewhere higher level package that uses this module

View File

@ -141,7 +141,7 @@ metadata:
}
}
// TODO We need valid test that checks that actuall bundle has arrived to applier
// TODO We need valid test that checks that actual bundle has arrived to applier
// for that we need a way to inject fake applier, which is not doable with `black box` test currently
// since we tests are in different package from executor
func TestExecutorRun(t *testing.T) {

View File

@ -40,7 +40,7 @@ type FakeAdaptor struct {
var _ Driver = FakeAdaptor{}
// NewFakeAdaptor returns a fake driver interface with convience methods for testing
// NewFakeAdaptor returns a fake driver interface with convenience methods for testing
func NewFakeAdaptor() FakeAdaptor {
return FakeAdaptor{}
}
@ -69,7 +69,7 @@ func (fa FakeAdaptor) WithEvents(events []applyevent.Event) FakeAdaptor {
return fa
}
// WithInitError adds error to Inititialize method
// WithInitError adds error to Initialize method
func (fa FakeAdaptor) WithInitError(err error) FakeAdaptor {
fa.initErr = err
return fa

View File

@ -60,7 +60,7 @@ var DefaultManifestReaderFactory ManifestReaderFactory = func(
return NewManifestBundleReader(validate, bundle, factory)
}
// NewManifestBundleReader returns impleemntation of manifestreader interface
// NewManifestBundleReader returns implementation of manifestreader interface
func NewManifestBundleReader(
validate bool,
bundle document.Bundle,

View File

@ -26,7 +26,7 @@ type GenericError struct {
Message string
}
// NewRemoteDirectErrorf retruns formatted remote direct errors
// NewRemoteDirectErrorf returns formatted remote direct errors
func NewRemoteDirectErrorf(format string, v ...interface{}) error {
return &GenericError{Message: fmt.Sprintf(format, v...)}
}

View File

@ -31,15 +31,15 @@ type MockFileSystem struct {
fs.FileSystem
}
// RemoveAll Filesystem interface imlementation
// RemoveAll Filesystem interface implementation
func (fsys MockFileSystem) RemoveAll(string) error { return fsys.MockRemoveAll() }
// TempFile Filesystem interface imlementation
// TempFile Filesystem interface implementation
func (fsys MockFileSystem) TempFile(root, pattern string) (document.File, error) {
return fsys.MockTempFile(root, pattern)
}
// TempDir Filesystem interface imlementation
// TempDir Filesystem interface implementation
func (fsys MockFileSystem) TempDir(string, string) (string, error) {
return fsys.MockTempDir()
}
@ -52,11 +52,11 @@ type TestFile struct {
MockClose func() error
}
// Name File interface imlementation
// Name File interface implementation
func (f TestFile) Name() string { return f.MockName() }
// Write File interface imlementation
// Write File interface implementation
func (f TestFile) Write([]byte) (int, error) { return f.MockWrite() }
// Close File interface imlementation
// Close File interface implementation
func (f TestFile) Close() error { return f.MockClose() }

View File

@ -319,7 +319,7 @@ func (i *InventoryObjectHandler) Handle(t *testing.T, req *http.Request) (*http.
type GenericHandler struct {
Obj runtime.Object
Namespace string
// URLPath is a string for formater in which it should be defined how to inject a namespace into it
// URLPath is a string for formatter in which it should be defined how to inject a namespace into it
// example : /namespaces/%s/deployments
URLPath string
Bytes []byte

View File

@ -71,7 +71,7 @@ func DummyContext() *config.Context {
// DummyManifest creates a Manifest config object for unit testing
func DummyManifest() *config.Manifest {
m := config.NewManifest()
// Repositories is the map of repository adddressable by a name
// Repositories is the map of repository addressable by a name
m.Repositories = map[string]*config.Repository{"primary": DummyRepository()}
m.PrimaryRepositoryName = "primary"
m.TargetPath = "/var/tmp/"