How to use Description method of engine Package

Best K6 code snippet using engine.Description

controller_test.go

Source:controller_test.go Github

copy

Full Screen

...86 if merr != nil {87 t.Error(merr)88 }89 identifierOK := errMessage.Id == ErrMissingAccountId.Id90 descriptionOK := errMessage.Description == ErrMissingAccountId.Description91 return isStatusBadRequest && identifierOK && descriptionOK92 })93}94func TestUploadFileMissingBucketName(t *testing.T) {95 controller := NewController(storage.StorageMock{})96 engine := gin.Default()97 engine.POST("/:accountId", controller.UploadFile)98 fileToUpload, _ := json.Marshal(&model.UploadData{99 FileName: "file.txt",100 Payload: []byte("Random data"),101 ContentType: "test/plain",102 })103 reader := bytes.NewReader(fileToUpload)104 req, _ := http.NewRequest("POST", fmt.Sprintf("/%s", AccountId), reader)105 req.Header.Add("Content-Type", "application/json")106 req.Header.Add("FileName", "file.txt")107 testHTTPResponse(t, engine, req, func(w *httptest.ResponseRecorder) bool {108 isStatusBadRequest := w.Code == http.StatusBadRequest109 var errMessage management.Error110 p, err := ioutil.ReadAll(w.Body)111 if err != nil {112 t.Error(err)113 }114 merr := json.Unmarshal(p, &errMessage)115 if merr != nil {116 t.Error(merr)117 }118 identifierOK := errMessage.Id == ErrMissingBucketName.Id119 descriptionOK := errMessage.Description == ErrMissingBucketName.Description120 return isStatusBadRequest && identifierOK && descriptionOK121 })122}123func TestUploadFileMissingFileName(t *testing.T) {124 controller := NewController(storage.StorageMock{})125 engine := gin.Default()126 engine.POST(":accountId/:bucketName", controller.UploadFile)127 fileToUpload, _ := json.Marshal(&model.UploadData{128 FileName: "", // A required field which is missing129 Payload: []byte("Random data"),130 ContentType: "test/plain",131 })132 reader := bytes.NewReader(fileToUpload)133 req, _ := http.NewRequest("POST", fmt.Sprintf("/%s/%s", AccountId, BucketName), reader)134 req.Header.Add("Content-Type", "application/json")135 req.Header.Add("FileName", "file.txt")136 testHTTPResponse(t, engine, req, func(w *httptest.ResponseRecorder) bool {137 isStatusBadRequest := w.Code == http.StatusBadRequest138 var errMessage management.Error139 p, err := ioutil.ReadAll(w.Body)140 if err != nil {141 t.Error(err)142 }143 merr := json.Unmarshal(p, &errMessage)144 if merr != nil {145 t.Error(merr)146 }147 identifierOK := errMessage.Id == ErrMissingFileName.Id148 descriptionOK := errMessage.Description == ErrMissingFileName.Description149 return isStatusBadRequest && identifierOK && descriptionOK150 })151}152func TestUploadFileMissingPayload(t *testing.T) {153 controller := NewController(storage.StorageMock{})154 engine := gin.Default()155 engine.POST(":accountId/:bucketName", controller.UploadFile)156 fileToUpload, _ := json.Marshal(&model.UploadData{ // Payload is missing157 FileName: "file.txt",158 ContentType: "test/plain",159 })160 reader := bytes.NewReader(fileToUpload)161 req, _ := http.NewRequest("POST", fmt.Sprintf("/%s/%s", AccountId, BucketName), reader)162 req.Header.Add("Content-Type", "application/json")163 req.Header.Add("FileName", "file.txt")164 testHTTPResponse(t, engine, req, func(w *httptest.ResponseRecorder) bool {165 isStatusBadRequest := w.Code == http.StatusBadRequest166 var errMessage management.Error167 p, err := ioutil.ReadAll(w.Body)168 if err != nil {169 t.Error(err)170 }171 merr := json.Unmarshal(p, &errMessage)172 if merr != nil {173 t.Error(merr)174 }175 identifierOK := errMessage.Id == ErrMissingPayload.Id176 descriptionOK := errMessage.Description == ErrMissingPayload.Description177 return isStatusBadRequest && identifierOK && descriptionOK178 })179}180func TestUploadFileMissingContentType(t *testing.T) {181 controller := NewController(storage.StorageMock{})182 engine := gin.Default()183 engine.POST(":accountId/:bucketName", controller.UploadFile)184 fileToUpload, _ := json.Marshal(&model.UploadData{185 FileName: "file.txt",186 Payload: []byte("Random data"),187 ContentType: "", // Content type is the required field that is empty188 })189 reader := bytes.NewReader(fileToUpload)190 req, _ := http.NewRequest("POST", fmt.Sprintf("/%s/%s", AccountId, BucketName), reader)191 req.Header.Add("Content-Type", "application/json")192 req.Header.Add("FileName", "file.txt")193 testHTTPResponse(t, engine, req, func(w *httptest.ResponseRecorder) bool {194 isStatusBadRequest := w.Code == http.StatusBadRequest195 var errMessage management.Error196 p, err := ioutil.ReadAll(w.Body)197 if err != nil {198 t.Error(err)199 }200 merr := json.Unmarshal(p, &errMessage)201 if merr != nil {202 t.Error(merr)203 }204 identifierOK := errMessage.Id == ErrMissingContentType.Id205 descriptionOK := errMessage.Description == ErrMissingContentType.Description206 return isStatusBadRequest && identifierOK && descriptionOK207 })208}209func TestUploadFileStorageProviderFailing(t *testing.T) {210 controller := NewController(storage.StorageMockFailure{})211 engine := gin.Default()212 engine.POST(":accountId/:bucketName", controller.UploadFile)213 fileToUpload, _ := json.Marshal(&model.UploadData{214 FileName: "file.txt",215 Payload: []byte("Random data"),216 ContentType: "test/plain",217 })218 reader := bytes.NewReader(fileToUpload)219 req, _ := http.NewRequest("POST", fmt.Sprintf("/%s/%s", AccountId, BucketName), reader)220 req.Header.Add("Content-Type", "application/json")221 req.Header.Add("FileName", "file.txt")222 testHTTPResponse(t, engine, req, func(w *httptest.ResponseRecorder) bool {223 return w.Code == http.StatusInternalServerError224 })225}226func TestDownloadFile(t *testing.T) {227 controller := NewController(storage.StorageMock{})228 engine := gin.Default()229 engine.GET("/:accountId/:bucketName/*fileName", controller.DownloadFile)230 req, _ := http.NewRequest("GET", fmt.Sprintf("/%s/%s/%s", AccountId, BucketName, FileName), nil)231 testHTTPResponse(t, engine, req, func(w *httptest.ResponseRecorder) bool {232 return w.Code == http.StatusOK233 })234}235func TestDownloadFileMissingAccountId(t *testing.T) {236 controller := NewController(storage.StorageMock{})237 engine := gin.Default()238 engine.GET("/:bucketName/*fileName", controller.DownloadFile)239 req, _ := http.NewRequest("GET", fmt.Sprintf("/%s/%s", BucketName, FileName), nil)240 testHTTPResponse(t, engine, req, func(w *httptest.ResponseRecorder) bool {241 isStatusBadRequest := w.Code == http.StatusBadRequest242 var errMessage management.Error243 p, err := ioutil.ReadAll(w.Body)244 if err != nil {245 t.Error(err)246 }247 merr := json.Unmarshal(p, &errMessage)248 if merr != nil {249 t.Error(merr)250 }251 identifierOK := errMessage.Id == ErrMissingAccountId.Id252 descriptionOK := errMessage.Description == ErrMissingAccountId.Description253 return isStatusBadRequest && identifierOK && descriptionOK254 })255}256func TestDownloadFileMissingBucketName(t *testing.T) {257 controller := NewController(storage.StorageMock{})258 engine := gin.Default()259 engine.GET("/:accountId/*fileName", controller.DownloadFile)260 req, _ := http.NewRequest("GET", fmt.Sprintf("/%s/%s", AccountId, FileName), nil)261 testHTTPResponse(t, engine, req, func(w *httptest.ResponseRecorder) bool {262 isStatusBadRequest := w.Code == http.StatusBadRequest263 var errMessage management.Error264 p, err := ioutil.ReadAll(w.Body)265 if err != nil {266 t.Error(err)267 }268 merr := json.Unmarshal(p, &errMessage)269 if merr != nil {270 t.Error(merr)271 }272 identifierOK := errMessage.Id == ErrMissingBucketName.Id273 descriptionOK := errMessage.Description == ErrMissingBucketName.Description274 return isStatusBadRequest && identifierOK && descriptionOK275 })276}277func TestDownloadFileMissingFileName(t *testing.T) {278 controller := NewController(storage.StorageMock{})279 engine := gin.Default()280 engine.GET("/:accountId/:bucketName", controller.DownloadFile)281 req, _ := http.NewRequest("GET", fmt.Sprintf("/%s/%s", AccountId, BucketName), nil)282 testHTTPResponse(t, engine, req, func(w *httptest.ResponseRecorder) bool {283 isStatusBadRequest := w.Code == http.StatusBadRequest284 var errMessage management.Error285 p, err := ioutil.ReadAll(w.Body)286 if err != nil {287 t.Error(err)288 }289 merr := json.Unmarshal(p, &errMessage)290 if merr != nil {291 t.Error(merr)292 }293 identifierOK := errMessage.Id == ErrMissingFileName.Id294 descriptionOK := errMessage.Description == ErrMissingFileName.Description295 return isStatusBadRequest && identifierOK && descriptionOK296 })297}298func TestDownloadFileFailingClient(t *testing.T) {299 controller := NewController(storage.StorageMockFailure{})300 engine := gin.Default()301 engine.GET("/:accountId/:bucketName/*fileName", controller.DownloadFile)302 req, _ := http.NewRequest("GET", fmt.Sprintf("/%s/%s/%s", AccountId, BucketName, FileName), nil)303 testHTTPResponse(t, engine, req, func(w *httptest.ResponseRecorder) bool {304 return w.Code == http.StatusInternalServerError305 })306}307func TestDeleteFile(t *testing.T) {308 controller := NewController(storage.StorageMock{})309 engine := gin.Default()310 engine.DELETE("/:accountId/:bucketName/*fileName", controller.DeleteFile)311 req, _ := http.NewRequest("DELETE", fmt.Sprintf("/%s/%s/%s", AccountId, BucketName, FileName), nil)312 testHTTPResponse(t, engine, req, func(w *httptest.ResponseRecorder) bool {313 return w.Code == http.StatusOK314 })315}316func TestDeleteFileMissingAccountId(t *testing.T) {317 controller := NewController(storage.StorageMock{})318 engine := gin.Default()319 engine.DELETE("/:bucketName/*fileName", controller.DeleteFile)320 req, _ := http.NewRequest("DELETE", fmt.Sprintf("/%s/%s", BucketName, FileName), nil)321 testHTTPResponse(t, engine, req, func(w *httptest.ResponseRecorder) bool {322 isStatusBadRequest := w.Code == http.StatusBadRequest323 var errMessage management.Error324 p, err := ioutil.ReadAll(w.Body)325 if err != nil {326 t.Error(err)327 }328 merr := json.Unmarshal(p, &errMessage)329 if merr != nil {330 t.Error(merr)331 }332 identifierOK := errMessage.Id == ErrMissingAccountId.Id333 descriptionOK := errMessage.Description == ErrMissingAccountId.Description334 return isStatusBadRequest && identifierOK && descriptionOK335 })336}337func TestDeleteFileMissingBucketName(t *testing.T) {338 controller := NewController(storage.StorageMock{})339 engine := gin.Default()340 engine.DELETE("/:accountId/*fileName", controller.DeleteFile)341 req, _ := http.NewRequest("DELETE", fmt.Sprintf("/%s/%s", AccountId, FileName), nil)342 testHTTPResponse(t, engine, req, func(w *httptest.ResponseRecorder) bool {343 isStatusBadRequest := w.Code == http.StatusBadRequest344 var errMessage management.Error345 p, err := ioutil.ReadAll(w.Body)346 if err != nil {347 t.Error(err)348 }349 merr := json.Unmarshal(p, &errMessage)350 if merr != nil {351 t.Error(merr)352 }353 identifierOK := errMessage.Id == ErrMissingBucketName.Id354 descriptionOK := errMessage.Description == ErrMissingBucketName.Description355 return isStatusBadRequest && identifierOK && descriptionOK356 })357}358func TestDeleteFileMissingFileName(t *testing.T) {359 controller := NewController(storage.StorageMock{})360 engine := gin.Default()361 engine.DELETE("/:accountId/:bucketName", controller.DeleteFile)362 req, _ := http.NewRequest("DELETE", fmt.Sprintf("/%s/%s", AccountId, BucketName), nil)363 testHTTPResponse(t, engine, req, func(w *httptest.ResponseRecorder) bool {364 isStatusBadRequest := w.Code == http.StatusBadRequest365 var errMessage management.Error366 p, err := ioutil.ReadAll(w.Body)367 if err != nil {368 t.Error(err)369 }370 merr := json.Unmarshal(p, &errMessage)371 if merr != nil {372 t.Error(merr)373 }374 identifierOK := errMessage.Id == ErrMissingFileName.Id375 descriptionOK := errMessage.Description == ErrMissingFileName.Description376 return isStatusBadRequest && identifierOK && descriptionOK377 })378}379func TestDeleteFileStorageProviderFailing(t *testing.T) {380 controller := NewController(storage.StorageMockFailure{})381 engine := gin.Default()382 engine.DELETE("/:accountId/:bucketName/*fileName", controller.DeleteFile)383 req, _ := http.NewRequest("DELETE", fmt.Sprintf("/%s/%s/%s", AccountId, BucketName, FileName), nil)384 testHTTPResponse(t, engine, req, func(w *httptest.ResponseRecorder) bool {385 return w.Code == http.StatusInternalServerError386 })387}388func TestCreateBucket(t *testing.T) {389 controller := NewController(storage.StorageMock{})390 engine := gin.Default()391 engine.POST("/:accountId", controller.CreateBucket)392 json, _ := json.Marshal(&model.Bucket{393 Name: "Test bucket",394 CreationDate: time.Now(),395 })396 reader := bytes.NewReader(json)397 req, _ := http.NewRequest("POST", "/"+AccountId, reader)398 req.Header.Add("Content-Type", "application/json")399 testHTTPResponse(t, engine, req, func(w *httptest.ResponseRecorder) bool {400 return w.Code == http.StatusOK401 })402}403func TestCreateBucketMissingName(t *testing.T) {404 controller := NewController(storage.StorageMock{})405 engine := gin.Default()406 engine.POST("/:accountId", controller.CreateBucket)407 bucket, _ := json.Marshal(&model.Bucket{408 Name: "",409 CreationDate: time.Now(),410 })411 reader := bytes.NewReader(bucket)412 req, _ := http.NewRequest("POST", "/"+AccountId, reader)413 req.Header.Add("Content-Type", "application/json")414 testHTTPResponse(t, engine, req, func(w *httptest.ResponseRecorder) bool {415 isStatusBadRequest := w.Code == http.StatusBadRequest416 var errMessage management.Error417 p, err := ioutil.ReadAll(w.Body)418 if err != nil {419 t.Error(err)420 }421 merr := json.Unmarshal(p, &errMessage)422 if merr != nil {423 t.Error(merr)424 }425 identifierOK := errMessage.Id == ErrMissingBucketName.Id426 descriptionOK := errMessage.Description == ErrMissingBucketName.Description427 return isStatusBadRequest && identifierOK && descriptionOK428 })429}430func TestCreateBucketMissingAccountId(t *testing.T) {431 controller := NewController(storage.StorageMock{})432 engine := gin.Default()433 engine.POST("/", controller.CreateBucket)434 bucket, _ := json.Marshal(&model.Bucket{435 Name: "Test bucket",436 CreationDate: time.Now(),437 })438 reader := bytes.NewReader(bucket)439 req, _ := http.NewRequest("POST", "/", reader)440 req.Header.Add("Content-Type", "application/json")441 testHTTPResponse(t, engine, req, func(w *httptest.ResponseRecorder) bool {442 isStatusBadRequest := w.Code == http.StatusBadRequest443 var errMessage management.Error444 p, err := ioutil.ReadAll(w.Body)445 if err != nil {446 t.Error(err)447 }448 merr := json.Unmarshal(p, &errMessage)449 if merr != nil {450 t.Error(merr)451 }452 identifierOK := errMessage.Id == ErrMissingAccountId.Id453 descriptionOK := errMessage.Description == ErrMissingAccountId.Description454 return isStatusBadRequest && identifierOK && descriptionOK455 })456}457func TestCreateBucketStorageProviderFailing(t *testing.T) {458 controller := NewController(storage.StorageMockFailure{})459 engine := gin.Default()460 engine.POST("/:accountId", controller.CreateBucket)461 json, _ := json.Marshal(&model.Bucket{462 Name: "Test bucket",463 CreationDate: time.Now(),464 })465 reader := bytes.NewReader(json)466 req, _ := http.NewRequest("POST", "/"+AccountId, reader)467 req.Header.Add("Content-Type", "application/json")468 testHTTPResponse(t, engine, req, func(w *httptest.ResponseRecorder) bool {469 return w.Code == http.StatusInternalServerError470 })471}472func TestListBuckets(t *testing.T) {473 controller := NewController(storage.StorageMock{})474 engine := gin.Default()475 engine.GET("/:accountId", controller.ListBuckets)476 req, _ := http.NewRequest("GET", fmt.Sprintf("/%s", AccountId), nil)477 testHTTPResponse(t, engine, req, func(w *httptest.ResponseRecorder) bool {478 return w.Code == http.StatusOK479 })480}481func TestListBucketsMissingAccountId(t *testing.T) {482 controller := NewController(storage.StorageMock{})483 engine := gin.Default()484 engine.GET("/", controller.ListBuckets)485 req, _ := http.NewRequest("GET", "/", nil)486 testHTTPResponse(t, engine, req, func(w *httptest.ResponseRecorder) bool {487 isStatusBadRequest := w.Code == http.StatusBadRequest488 var errMessage management.Error489 p, err := ioutil.ReadAll(w.Body)490 if err != nil {491 t.Error(err)492 }493 merr := json.Unmarshal(p, &errMessage)494 if merr != nil {495 t.Error(merr)496 }497 identifierOK := errMessage.Id == ErrMissingAccountId.Id498 descriptionOK := errMessage.Description == ErrMissingAccountId.Description499 return isStatusBadRequest && identifierOK && descriptionOK500 })501}502func TestListBucketsStorageProviderFailure(t *testing.T) {503 controller := NewController(storage.StorageMockFailure{})504 engine := gin.Default()505 engine.GET("/:accountId", controller.ListBuckets)506 req, _ := http.NewRequest("GET", fmt.Sprintf("/%s", AccountId), nil)507 testHTTPResponse(t, engine, req, func(w *httptest.ResponseRecorder) bool {508 return w.Code == http.StatusInternalServerError509 })510}511func TestDeleteBucket(t *testing.T) {512 controller := NewController(storage.StorageMock{})513 engine := gin.Default()514 engine.DELETE(":accountId/:bucketName", controller.DeleteBucket)515 req, _ := http.NewRequest("DELETE", fmt.Sprintf("/%s/%s", AccountId, BucketName), nil)516 testHTTPResponse(t, engine, req, func(w *httptest.ResponseRecorder) bool {517 return w.Code == http.StatusOK518 })519}520func TestDeleteBucketMissingAccountId(t *testing.T) {521 controller := NewController(storage.StorageMock{})522 engine := gin.Default()523 engine.DELETE(":bucketName", controller.DeleteBucket)524 req, _ := http.NewRequest("DELETE", fmt.Sprintf("/%s", BucketName), nil)525 testHTTPResponse(t, engine, req, func(w *httptest.ResponseRecorder) bool {526 isStatusBadRequest := w.Code == http.StatusBadRequest527 var errMessage management.Error528 p, err := ioutil.ReadAll(w.Body)529 if err != nil {530 t.Error(err)531 }532 merr := json.Unmarshal(p, &errMessage)533 if merr != nil {534 t.Error(merr)535 }536 identifierOK := errMessage.Id == ErrMissingAccountId.Id537 descriptionOK := errMessage.Description == ErrMissingAccountId.Description538 return isStatusBadRequest && identifierOK && descriptionOK539 })540}541func TestDeleteBucketMissingBucketName(t *testing.T) {542 controller := NewController(storage.StorageMock{})543 engine := gin.Default()544 engine.DELETE(":accountId", controller.DeleteBucket)545 req, _ := http.NewRequest("DELETE", fmt.Sprintf("/%s", AccountId), nil)546 testHTTPResponse(t, engine, req, func(w *httptest.ResponseRecorder) bool {547 isStatusBadRequest := w.Code == http.StatusBadRequest548 var errMessage management.Error549 p, err := ioutil.ReadAll(w.Body)550 if err != nil {551 t.Error(err)552 }553 merr := json.Unmarshal(p, &errMessage)554 if merr != nil {555 t.Error(merr)556 }557 identifierOK := errMessage.Id == ErrMissingBucketName.Id558 descriptionOK := errMessage.Description == ErrMissingBucketName.Description559 return isStatusBadRequest && identifierOK && descriptionOK560 })561}562func TestListFiles(t *testing.T) {563 controller := NewController(storage.StorageMock{})564 engine := gin.Default()565 engine.GET(":accountId/:bucketName", controller.ListFiles)566 req, _ := http.NewRequest("GET", fmt.Sprintf("/%s/%s", AccountId, BucketName), nil)567 testHTTPResponse(t, engine, req, func(w *httptest.ResponseRecorder) bool {568 return w.Code == http.StatusOK569 })570}571func TestListFilesMissingAccountId(t *testing.T) {572 controller := NewController(storage.StorageMock{})573 engine := gin.Default()574 engine.GET(":bucketName", controller.ListFiles)575 req, _ := http.NewRequest("GET", fmt.Sprintf("/%s", BucketName), nil)576 testHTTPResponse(t, engine, req, func(w *httptest.ResponseRecorder) bool {577 isStatusBadRequest := w.Code == http.StatusBadRequest578 var errMessage management.Error579 p, err := ioutil.ReadAll(w.Body)580 if err != nil {581 t.Error(err)582 }583 merr := json.Unmarshal(p, &errMessage)584 if merr != nil {585 t.Error(merr)586 }587 identifierOK := errMessage.Id == ErrMissingAccountId.Id588 descriptionOK := errMessage.Description == ErrMissingAccountId.Description589 return isStatusBadRequest && identifierOK && descriptionOK590 })591}592func TestListFilesMissingBucketName(t *testing.T) {593 controller := NewController(storage.StorageMock{})594 engine := gin.Default()595 engine.GET(":accountId", controller.ListFiles)596 req, _ := http.NewRequest("GET", fmt.Sprintf("/%s", AccountId), nil)597 testHTTPResponse(t, engine, req, func(w *httptest.ResponseRecorder) bool {598 isStatusBadRequest := w.Code == http.StatusBadRequest599 var errMessage management.Error600 p, err := ioutil.ReadAll(w.Body)601 if err != nil {602 t.Error(err)603 }604 merr := json.Unmarshal(p, &errMessage)605 if merr != nil {606 t.Error(merr)607 }608 identifierOK := errMessage.Id == ErrMissingBucketName.Id609 descriptionOK := errMessage.Description == ErrMissingBucketName.Description610 return isStatusBadRequest && identifierOK && descriptionOK611 })612}613func TestListFilesStorageProviderFailure(t *testing.T) {614 controller := NewController(storage.StorageMockFailure{})615 engine := gin.Default()616 engine.GET(":accountId/:bucketName", controller.ListFiles)617 req, _ := http.NewRequest("GET", fmt.Sprintf("/%s/%s", AccountId, BucketName), nil)618 testHTTPResponse(t, engine, req, func(w *httptest.ResponseRecorder) bool {619 return w.Code == http.StatusInternalServerError620 })621}622// Helper function to process a request and test its response623func testHTTPResponse(t *testing.T,...

Full Screen

Full Screen

secrets-engines.go

Source:secrets-engines.go Github

copy

Full Screen

...62 }63 log.Debug("Secrets engine path [" + secretsEngine.Path + "] already enabled and type matches, tuning for any updates")64 // Update the MountConfigInput description to match the MountInput description65 // This is needed because of the way creating new mounts differs from existing ones?66 secretsEngine.MountInput.Config.Description = &secretsEngine.MountInput.Description67 tunePath := path.Join("sys/mounts", secretsEngine.Path, "tune")68 task := taskWrite{69 Path: tunePath,70 Description: fmt.Sprintf("Secrets backend tune for [%s]", tunePath),71 Data: structToMap(secretsEngine.MountInput.Config),72 }73 wg.Add(1)74 taskChan <- task75 }76 } else {77 log.Debug("Secrets engine path [" + secretsEngine.Path + "] is not enabled, enabling")78 err := VaultSys.Mount(secretsEngine.Path, &secretsEngine.MountInput)79 if err != nil {80 log.Fatal("Error mounting secret type ["+secretsEngine.MountInput.Type+"] mounted at ["+secretsEngine.Path+"]; ", err)81 }82 log.Info("Secrets engine type [" + secretsEngine.MountInput.Type + "] enabled at [" + secretsEngine.Path + "]")83 secretsEngine.JustEnabled = true84 }85 if secretsEngine.Path == "identity/" {86 log.Info("Configuring Identity backend ", secretsEngine.Path)87 e := IdentitySecretsEngine{MountPath: secretsEngine.Path}88 e.run()89 } else if secretsEngine.MountInput.Type == "aws" {90 log.Info("Configuring AWS backend ", secretsEngine.Path)91 ConfigureAwsSecretsEngine(secretsEngine)92 } else if secretsEngine.MountInput.Type == "database" {93 log.Info("Configuring database backend ", secretsEngine.Path)94 ConfigureDatabaseSecretsEngine(secretsEngine)95 } else {96 log.Warn("Secrets engine types other than 'aws', 'database' and 'identity' not currently configurable, please open PR!")97 }98 }99}100func CleanupSecretsEngines(secretsEnginesList SecretsEnginesList) {101 existing_mounts, _ := VaultSys.ListMounts()102 for mountPath, mountOutput := range existing_mounts {103 // Ignore default mounts104 // generic = old kv store105 if !(mountOutput.Type == "system" || mountOutput.Type == "cubbyhole" || mountOutput.Type == "identity" || mountOutput.Type == "kv" || mountOutput.Type == "generic") {106 if _, ok := secretsEnginesList[mountPath]; ok {107 log.Debug("Secrets engine [" + mountPath + "] exists in configuration, no cleanup necessary")108 } else {109 secretEnginePath := path.Join("sys/mounts", mountPath)110 task := taskDelete{111 Description: fmt.Sprintf("Secrets engine [%s]", secretEnginePath),112 Path: secretEnginePath,113 }114 taskPromptChan <- task115 }116 }117 }118}...

Full Screen

Full Screen

node.go

Source:node.go Github

copy

Full Screen

...25 node.CreatedAt, _ = gogotypes.TimestampFromProto(n.Meta.CreatedAt)26 node.UpdatedAt, _ = gogotypes.TimestampFromProto(n.Meta.UpdatedAt)27 //Annotations28 node.Spec.Annotations = annotationsFromGRPC(n.Spec.Annotations)29 //Description30 if n.Description != nil {31 node.Description.Hostname = n.Description.Hostname32 if n.Description.Platform != nil {33 node.Description.Platform.Architecture = n.Description.Platform.Architecture34 node.Description.Platform.OS = n.Description.Platform.OS35 }36 if n.Description.Resources != nil {37 node.Description.Resources.NanoCPUs = n.Description.Resources.NanoCPUs38 node.Description.Resources.MemoryBytes = n.Description.Resources.MemoryBytes39 node.Description.Resources.GenericResources = GenericResourcesFromGRPC(n.Description.Resources.Generic)40 }41 if n.Description.Engine != nil {42 node.Description.Engine.EngineVersion = n.Description.Engine.EngineVersion43 node.Description.Engine.Labels = n.Description.Engine.Labels44 for _, plugin := range n.Description.Engine.Plugins {45 node.Description.Engine.Plugins = append(node.Description.Engine.Plugins, types.PluginDescription{Type: plugin.Type, Name: plugin.Name})46 }47 }48 if n.Description.TLSInfo != nil {49 node.Description.TLSInfo.TrustRoot = string(n.Description.TLSInfo.TrustRoot)50 node.Description.TLSInfo.CertIssuerPublicKey = n.Description.TLSInfo.CertIssuerPublicKey51 node.Description.TLSInfo.CertIssuerSubject = n.Description.TLSInfo.CertIssuerSubject52 }53 }54 //Manager55 if n.ManagerStatus != nil {56 node.ManagerStatus = &types.ManagerStatus{57 Leader: n.ManagerStatus.Leader,58 Reachability: types.Reachability(strings.ToLower(n.ManagerStatus.Reachability.String())),59 Addr: n.ManagerStatus.Addr,60 }61 }62 return node63}64// NodeSpecToGRPC converts a NodeSpec to a grpc NodeSpec.65func NodeSpecToGRPC(s types.NodeSpec) (swarmapi.NodeSpec, error) {...

Full Screen

Full Screen

Description

Using AI Code Generation

copy

Full Screen

1import "fmt"2type Engine struct {3}4func (e Engine) Description() {5 fmt.Println("Cylinders:", e.cylinders, "- Horsepower:", e.horsepower)6}7func main() {8 engine := Engine{cylinders: 4, horsepower: 250}9 engine.Description()10}11import "fmt"12type Engine struct {13}14func (e *Engine) Description() {15 fmt.Println("Cylinders:", e.cylinders, "- Horsepower:", e.horsepower)16}17func main() {18 engine := Engine{cylinders: 4, horsepower: 250}19 engine.Description()20}

Full Screen

Full Screen

Description

Using AI Code Generation

copy

Full Screen

1import "fmt"2func main() {3 e.Description()4}5import "fmt"6func main() {7 c.Description()8}9import "fmt"10func main() {11 t.Description()12}13type embedding struct {14}15type car struct {16}17import "fmt"18func main() {19 c := car{model: "BMW", power: 1000}20 c.Description()21}22func (c car) Description() {23 fmt.Println("Car Description")24}25import "fmt"

Full Screen

Full Screen

Description

Using AI Code Generation

copy

Full Screen

1import (2func main() {3 e := Engine{}4 e.Description()5}6import (7func main() {8 e := Engine{}9 e.Description()10}11import (12func main() {13 e := Engine{}14 e.Description()15}16import (17func main() {18 e := Engine{}19 e.Description()20}21import (22func main() {23 e := Engine{}24 e.Description()25}26import (27func main() {28 e := Engine{}29 e.Description()30}31import (32func main() {33 e := Engine{}34 e.Description()35}36import (37func main() {38 e := Engine{}39 e.Description()40}41import (42func main() {43 e := Engine{}44 e.Description()45}46import (47func main() {48 e := Engine{}49 e.Description()50}51import (52func main() {53 e := Engine{}54 e.Description()55}56import (57func main() {58 e := Engine{}59 e.Description()60}61import (62func main() {63 e := Engine{}64 e.Description()65}66import

Full Screen

Full Screen

Description

Using AI Code Generation

copy

Full Screen

1import (2func main() {3 myengine.Description()4}5import (6func main() {7 myengine.Description()8}9import (10func Description() {11 fmt.Println("This is a 2.0L engine")12}13import (14func TestDescription(t *testing.T) {15 Description()16}17import (18func TestDescription(t *testing.T) {19 Description()20}21t.Fatal(): It is used to report a failure. The test case will stop running after

Full Screen

Full Screen

Description

Using AI Code Generation

copy

Full Screen

1import "fmt"2func main() {3 e = car{4, "Honda"}4 fmt.Println(e.Description())5}6import "fmt"7func main() {8 e = bike{2, "Yamaha"}9 fmt.Println(e.Description())10}11import "fmt"12func main() {13 e = car{4, "Honda"}14 fmt.Println(e.Description())15 e = bike{2, "Yamaha"}16 fmt.Println(e.Description())17}

Full Screen

Full Screen

Description

Using AI Code Generation

copy

Full Screen

1import (2func main() {3 fmt.Println("Hello World")4}5import (6type Engine struct {7}8func (e *Engine) Description() string {9}10import (11type Car struct {12}13func main() {14 car := Car{Engine{"V8"}}15 fmt.Println(car.Description())16}17import (18func main() {19 fmt.Println("Hello World")20}21import (22type Engine struct {23}24func (e *Engine) Description() string {25}26import (27type Car struct {28}29func main() {30 car := Car{Engine{"V8"}}31 fmt.Println(car.Description())32}33import (34func main() {35 fmt.Println("Hello World")36}37import (38type Engine struct {39}40func (e *Engine) Description() string {41}42import (43type Car struct {44}45func main() {46 car := Car{Engine{"V8"}}47 fmt.Println(car.Description())48}49import (50func main() {51 fmt.Println("Hello World")52}53import (54type Engine struct {55}56func (e *Engine) Description() string {57}58import (59type Car struct {60}61func main() {62 car := Car{Engine{"V8"}}63 fmt.Println(car.Description())64}65import (66func main() {67 fmt.Println("Hello World")68}69import (

Full Screen

Full Screen

Description

Using AI Code Generation

copy

Full Screen

1import "fmt"2func main(){3 a = Engine{4, "V8"}4 fmt.Println(a.Description())5}6import "fmt"7func main(){8 a = Car{Engine{4, "V8"}, 4}9 fmt.Println(a.Description())10}11import "fmt"12func main(){13 a = Car{Engine{4, "V8"}, 4}14 fmt.Println(a.Description())15}

Full Screen

Full Screen

Description

Using AI Code Generation

copy

Full Screen

1import (2func main() {3 myEngine := engines.NewEngine(4, "V8")4 fmt.Println(myEngine.Description())5}6import (7func main() {8 myEngine := cars.NewEngine(4, "V8")9 myCar := cars.NewCar("Ferrari", "488GTB", myEngine)10 fmt.Println(myCar.Description())11}12import (13func main() {14 myEngine := cars.NewEngine(4, "V8")15 myCar := cars.NewCar("Ferrari", "488GTB", myEngine)16 myTruck := cars.NewTruck("Volvo", "FH16", myEngine, 10000.0)17 fmt.Println(myCar.Description())18 fmt.Println(myTruck.Description())19}20import (21func main() {22 myEngine := cars.NewEngine(4, "V8")23 myCar := cars.NewCar("Ferrari", "488GTB", myEngine)24 myTruck := cars.NewTruck("Volvo", "FH16", myEngine, 10000.0)25 vehicles := []cars.Vehicle{myCar, myTruck}26 for _, vehicle := range vehicles {27 fmt.Println(vehicle.Description())28 }29}30import (31func main() {32 myEngine := cars.NewEngine(4, "V8")33 myCar := cars.NewCar("Ferrari", "488GTB", myEngine)

Full Screen

Full Screen

Automation Testing Tutorials

Learn to execute automation testing from scratch with LambdaTest Learning Hub. Right from setting up the prerequisites to run your first automation test, to following best practices and diving deeper into advanced test scenarios. LambdaTest Learning Hubs compile a list of step-by-step guides to help you be proficient with different test automation frameworks i.e. Selenium, Cypress, TestNG etc.

LambdaTest Learning Hubs:

YouTube

You could also refer to video tutorials over LambdaTest YouTube channel to get step by step demonstration from industry experts.

Run K6 automation tests on LambdaTest cloud grid

Perform automation testing on 3000+ real desktop and mobile devices online.

Try LambdaTest Now !!

Get 100 minutes of automation test minutes FREE!!

Next-Gen App & Browser Testing Cloud

Was this article helpful?

Helpful

NotHelpful