How to use get method of config Package

Best Gauge code snippet using config.get

start.go

Source:start.go Github

copy

Full Screen

...152 proxyConfig.AddNoProxy(ip)153 proxyConfig.ApplyToEnvironment()154 }155 applyDockerEnvToProcessEnv(libMachineClient)156 err := clusterup.EnsureHostDirectoriesExist(hostVm, getRequiredHostDirectories())157 if err != nil {158 atexit.ExitWithMessage(1, fmt.Sprintf("Error creating required host directories: %v", err))159 }160 autoMountHostFolders(hostVm.Driver)161 requestedOpenShiftVersion := viper.GetString(configCmd.OpenshiftVersion.Name)162 if !isRestart {163 importContainerImages(hostVm.Driver, libMachineClient, requestedOpenShiftVersion)164 }165 ocPath := cmdUtil.CacheOc(clusterup.DetermineOcVersion(requestedOpenShiftVersion))166 clusterUpConfig := &clusterup.ClusterUpConfig{167 OpenShiftVersion: requestedOpenShiftVersion,168 MachineName: constants.MachineName,169 Ip: ip,170 Port: constants.APIServerPort,171 RoutingSuffix: getDefaultRoutingPrefix(ip),172 HostPvDir: viper.GetString(configCmd.HostPvDir.Name),173 User: minishiftConstants.DefaultUser,174 Project: minishiftConstants.DefaultProject,175 KubeConfigPath: constants.KubeConfigPath,176 OcPath: ocPath,177 AddonEnv: viper.GetStringSlice(cmdUtil.AddOnEnv),178 PublicHostname: viper.GetString(configCmd.PublicHostname.Name),179 }180 clusterUpParams := determineClusterUpParameters(clusterUpConfig)181 fmt.Println("-- OpenShift cluster will be configured with ...")182 fmt.Println(" Version:", requestedOpenShiftVersion)183 err = clusterup.ClusterUp(clusterUpConfig, clusterUpParams, &util.RealRunner{})184 if err != nil {185 atexit.ExitWithMessage(1, fmt.Sprintf("Error during 'cluster up' execution: %v", err))186 }187 if !IsOpenShiftRunning(hostVm.Driver) {188 atexit.ExitWithMessage(1, "OpenShift provisioning failed. origin container failed to start.")189 }190 if !isRestart {191 postClusterUp(hostVm, clusterUpConfig)192 exportContainerImages(hostVm.Driver, libMachineClient, requestedOpenShiftVersion)193 }194 if isRestart {195 err = cmdUtil.SetOcContext(minishiftConfig.AllInstancesConfig.ActiveProfile)196 if err != nil {197 fmt.Println(fmt.Sprintf("Could not set oc CLI context for: %s", profileActions.GetActiveProfile()))198 }199 }200}201// postClusterUp performs configuration action which only need to be run after an initial provision of OpenShift.202// On subsequent VM restarts these actions can be skipped.203func postClusterUp(hostVm *host.Host, clusterUpConfig *clusterup.ClusterUpConfig) {204 sshCommander := provision.GenericSSHCommander{Driver: hostVm.Driver}205 err := clusterup.PostClusterUp(clusterUpConfig, sshCommander, addon.GetAddOnManager())206 if err != nil {207 atexit.ExitWithMessage(1, fmt.Sprintf("Error during post cluster up configuration: %v", err))208 }209}210// getRequiredHostDirectories returns a list of directories we need to ensure exist on the VM.211func getRequiredHostDirectories() []string {212 return []string{213 viper.GetString(configCmd.HostConfigDir.Name),214 viper.GetString(configCmd.HostDataDir.Name),215 viper.GetString(configCmd.HostVolumeDir.Name),216 viper.GetString(configCmd.HostPvDir.Name),217 }218}219func handleProxies() *util.ProxyConfig {220 proxyConfig, err := util.NewProxyConfig(viper.GetString(cmdUtil.HttpProxy), viper.GetString(cmdUtil.HttpsProxy), viper.GetString(configCmd.NoProxyList.Name))221 if err != nil {222 atexit.ExitWithMessage(1, err.Error())223 }224 if proxyConfig.IsEnabled() {225 proxyConfig.ApplyToEnvironment()226 dockerEnv = append(dockerEnv, proxyConfig.ProxyConfig()...)227 shellProxyEnv += strings.Join(proxyConfig.ProxyConfig(), " ")228 // It could be that the proxy config is retrieved from the environment. To make sure that229 // proxy settings are properly passed to cluster up we need to explicitly set the values.230 if proxyConfig.HttpProxy() != "" {231 viper.Set(cmdUtil.HttpProxy, proxyConfig.HttpProxy())232 }233 if proxyConfig.HttpsProxy() != "" {234 viper.Set(cmdUtil.HttpsProxy, proxyConfig.HttpsProxy())235 }236 viper.Set(configCmd.NoProxyList.Name, proxyConfig.NoProxy())237 }238 return proxyConfig239}240// getSlice return slice for provided key otherwise nil241func getSlice(key string) []string {242 if viper.IsSet(key) {243 return viper.GetStringSlice(key)244 }245 return nil246}247func determineInsecureRegistry(key string) []string {248 s := getSlice(key)249 if s != nil {250 for _, v := range s {251 if v == defaultInsecureRegistry {252 return s253 }254 }255 }256 return append(s, defaultInsecureRegistry)257}258func startHost(libMachineClient *libmachine.Client) *host.Host {259 progressDots := progressdots.New()260 // Configuration used for creation/setup of the Virtual Machine261 machineConfig := &cluster.MachineConfig{262 MinikubeISO: determineIsoUrl(viper.GetString(configCmd.ISOUrl.Name)),263 ISOCacheDir: state.InstanceDirs.IsoCache,264 Memory: calculateMemorySize(viper.GetString(configCmd.Memory.Name)),265 CPUs: viper.GetInt(configCmd.CPUs.Name),266 DiskSize: calculateDiskSize(viper.GetString(configCmd.DiskSize.Name)),267 VMDriver: viper.GetString(configCmd.VmDriver.Name),268 DockerEnv: append(dockerEnv, getSlice(configCmd.DockerEnv.Name)...),269 DockerEngineOpt: getSlice(configCmd.DockerEngineOpt.Name),270 InsecureRegistry: determineInsecureRegistry(configCmd.InsecureRegistry.Name),271 RegistryMirror: getSlice(configCmd.RegistryMirror.Name),272 HostOnlyCIDR: viper.GetString(configCmd.HostOnlyCIDR.Name),273 ShellProxyEnv: shellProxyEnv,274 }275 fmt.Printf(" using '%s' hypervisor ...\n", machineConfig.VMDriver)276 var hostVm *host.Host277 // configuration with these settings only happen on create278 isRestart := cmdUtil.VMExists(libMachineClient, constants.MachineName)279 if !isRestart {280 fmt.Println("-- Minishift VM will be configured with ...")281 fmt.Println(" Memory: ", units.HumanSize(float64((machineConfig.Memory/units.KiB)*units.GB)))282 fmt.Println(" vCPUs : ", machineConfig.CPUs)283 fmt.Println(" Disk size:", units.HumanSize(float64(machineConfig.DiskSize*units.MB)))284 }285 // Experimental features286 if minishiftConfig.EnableExperimental {287 networkSettings := minishiftNetwork.NetworkSettings{288 Device: viper.GetString(configCmd.NetworkDevice.Name),289 IPAddress: viper.GetString(configCmd.IPAddress.Name),290 Netmask: viper.GetString(configCmd.Netmask.Name),291 Gateway: viper.GetString(configCmd.Gateway.Name),292 DNS1: viper.GetString(configCmd.NameServer.Name),293 }294 // Configure networking on startup only works on Hyper-V295 if networkSettings.IPAddress != "" {296 minishiftNetwork.ConfigureNetworking(constants.MachineName, machineConfig.VMDriver, networkSettings)297 }298 }299 cacheMinishiftISO(machineConfig)300 fmt.Print("-- Starting Minishift VM ...")301 progressDots.Start()302 start := func() (err error) {303 hostVm, err = cluster.StartHost(libMachineClient, *machineConfig)304 if err != nil {305 fmt.Print(" FAIL ")306 glog.Errorf("Error starting the VM: %s. Retrying.\n", err)307 }308 return err309 }310 err := util.Retry(3, start)311 if err != nil {312 atexit.ExitWithMessage(1, fmt.Sprintf("Error starting the VM: %v", err))313 }314 progressDots.Stop()315 fmt.Println(" OK")316 return hostVm317}318func autoMountHostFolders(driver drivers.Driver) {319 if hostfolder.IsAutoMount() && hostfolder.IsHostfoldersDefined() {320 hostfolder.MountHostfolders(driver)321 }322}323func addActiveProfileInformation() {324 if constants.ProfileName != profileActions.GetActiveProfile() {325 fmt.Println(fmt.Sprintf("-- Switching active profile to '%s'", constants.ProfileName))326 err := profileActions.SetActiveProfile(constants.ProfileName)327 if err != nil {328 atexit.ExitWithMessage(1, err.Error())329 }330 }331}332func importContainerImages(driver drivers.Driver, api libmachine.API, openShiftVersion string) {333 if !viper.GetBool(configCmd.ImageCaching.Name) {334 return335 }336 images := viper.GetStringSlice(configCmd.CacheImages.Name)337 for _, coreImage := range image.GetOpenShiftImageNames(openShiftVersion) {338 if !stringUtils.Contains(images, coreImage) {339 images = append(images, coreImage)340 }341 }342 envMap, err := cluster.GetHostDockerEnv(api)343 if err != nil {344 atexit.ExitWithMessage(1, fmt.Sprintf("Error determining Docker settings for image import: %v", err))345 }346 handler := getImageHandler(driver, envMap)347 config := &image.ImageCacheConfig{348 HostCacheDir: state.InstanceDirs.ImageCache,349 CachedImages: images,350 Out: os.Stdout,351 }352 _, err = handler.ImportImages(config)353 if err != nil {354 fmt.Println(fmt.Sprintf(" WARN: At least one image could not be imported. Error: %s ", err.Error()))355 }356}357func getImageHandler(driver drivers.Driver, envMap map[string]string) image.ImageHandler {358 handler, err := image.NewOciImageHandler(driver, envMap)359 if err != nil {360 atexit.ExitWithMessage(1, fmt.Sprintf("Unable to create image handler: %v", err))361 }362 return handler363}364// exportContainerImages exports the OpenShift images in a background process (by calling 'minishift image export')365func exportContainerImages(driver drivers.Driver, api libmachine.API, version string) {366 if !viper.GetBool(configCmd.ImageCaching.Name) {367 return368 }369 images := viper.GetStringSlice(configCmd.CacheImages.Name)370 for _, coreImage := range image.GetOpenShiftImageNames(version) {371 if !stringUtils.Contains(images, coreImage) {372 images = append(images, coreImage)373 }374 }375 envMap, err := cluster.GetHostDockerEnv(api)376 if err != nil {377 atexit.ExitWithMessage(1, fmt.Sprintf("Error determining Docker settings for image import: %v", err))378 }379 handler := getImageHandler(driver, envMap)380 config := &image.ImageCacheConfig{381 HostCacheDir: state.InstanceDirs.ImageCache,382 CachedImages: images,383 }384 if handler.AreImagesCached(config) {385 return386 }387 exportCmd, err := image.CreateExportCommand(version, constants.ProfileName, images)388 if err != nil {389 atexit.ExitWithMessage(1, fmt.Sprintf("Error creating export command: %v", err))390 }391 err = exportCmd.Start()392 if err != nil {393 atexit.ExitWithMessage(1, fmt.Sprintf("Error during export: %v", err))394 }395 fmt.Println(fmt.Sprintf("-- Exporting of OpenShift images is occuring in background process with pid %d.", exportCmd.Process.Pid))396}397func calculateMemorySize(memorySize string) int {398 if stringUtils.HasOnlyNumbers(memorySize) {399 memorySize += "MB"400 }401 // err := minishiftConfig.IsValidMemorySize(configCmd.Memory.Name, humanReadableSize)402 size, err := units.RAMInBytes(memorySize)403 if err != nil {404 fmt.Println()405 atexit.ExitWithMessage(1, fmt.Sprintf("Memory size is not valid: %v", err))406 }407 return int(size / units.MiB)408}409func calculateDiskSize(humanReadableSize string) int {410 if stringUtils.HasOnlyNumbers(humanReadableSize) {411 humanReadableSize += "MB"412 }413 // err := minishiftConfig.IsValidDiskSize(configCmd.DiskSize.Name, humanReadableSize)414 size, err := units.FromHumanSize(humanReadableSize)415 if err != nil {416 fmt.Println()417 atexit.ExitWithMessage(1, fmt.Sprintf("Disk size is not valid: %v", err))418 }419 return int(size / units.MB)420}421func determineIsoUrl(iso string) string {422 isoNotSpecified := ""423 switch strings.ToLower(iso) {424 case minishiftConstants.B2dIsoAlias, isoNotSpecified:425 iso = constants.DefaultB2dIsoUrl426 case minishiftConstants.CentOsIsoAlias:427 iso = constants.DefaultCentOsIsoUrl428 case minishiftConstants.MinikubeIsoAlias:429 iso = constants.DefaultMinikubeIsoURL430 default:431 if !(govalidator.IsURL(iso) || strings.HasPrefix(iso, "file:")) {432 fmt.Println()433 atexit.ExitWithMessage(1, unsupportedIsoUrlFormat)434 }435 }436 return iso437}438// initStartFlags creates the CLI flags which needs to be passed on to 'libmachine'439func initStartFlags() *flag.FlagSet {440 startFlagSet := flag.NewFlagSet(commandName, flag.ContinueOnError)441 startFlagSet.String(configCmd.VmDriver.Name, constants.DefaultVMDriver, fmt.Sprintf("The driver to use for the Minishift VM. Possible values: %v", constants.SupportedVMDrivers))442 startFlagSet.Int(configCmd.CPUs.Name, constants.DefaultCPUS, "Number of CPU cores to allocate to the Minishift VM.")443 startFlagSet.String(configCmd.Memory.Name, constants.DefaultMemory, "Amount of RAM to allocate to the Minishift VM. Use the format <size><unit>, where unit = MB or GB.")444 startFlagSet.String(configCmd.DiskSize.Name, constants.DefaultDiskSize, "Disk size to allocate to the Minishift VM. Use the format <size><unit>, where unit = MB or GB.")445 startFlagSet.String(configCmd.HostOnlyCIDR.Name, "192.168.99.1/24", "The CIDR to be used for the minishift VM. (Only supported with VirtualBox driver.)")446 startFlagSet.AddFlag(dockerEnvFlag)447 startFlagSet.AddFlag(dockerEngineOptFlag)448 startFlagSet.AddFlag(insecureRegistryFlag)449 startFlagSet.AddFlag(registryMirrorFlag)450 startFlagSet.AddFlag(cmdUtil.AddOnEnvFlag)451 if minishiftConfig.EnableExperimental && runtime.GOOS == "windows" {452 startFlagSet.String(configCmd.NetworkDevice.Name, "eth0", "Specify the network device to use for the IP address. Ignored if no IP address specified (experimental - Hyper-V only)")453 startFlagSet.String(configCmd.IPAddress.Name, "", "Specify IP address to assign to the instance (experimental - Hyper-V only)")454 startFlagSet.String(configCmd.Netmask.Name, "24", "Specify netmask to use for the IP address. Ignored if no IP address specified (experimental - Hyper-V only)")455 startFlagSet.String(configCmd.Gateway.Name, "", "Specify gateway to use for the instance. Ignored if no IP address specified (experimental - Hyper-V only)")456 startFlagSet.String(configCmd.NameServer.Name, "8.8.8.8", "Specify nameserver to use for the instance. Ignored if no IP address specified (experimental - Hyper-V only)")457 }458 if minishiftConfig.EnableExperimental {459 startFlagSet.String(configCmd.ISOUrl.Name, minishiftConstants.B2dIsoAlias, "Location of the minishift ISO. Can be an URL, file URI or one of the following short names: [b2d centos minikube].")460 } else {461 startFlagSet.String(configCmd.ISOUrl.Name, minishiftConstants.B2dIsoAlias, "Location of the minishift ISO. Can be an URL, file URI or one of the following short names: [b2d centos].")462 }463 return startFlagSet464}465// initClusterUpFlags creates the CLI flags which needs to be passed on to 'oc cluster up'466func initClusterUpFlags() *flag.FlagSet {467 clusterUpFlagSet := flag.NewFlagSet(commandName, flag.ContinueOnError)468 //clusterUpFlagSet.StringVar(&clusterUpConfig.Image, "image", "openshift/origin", "Specify the images to use for OpenShift")469 clusterUpFlagSet.Bool(configCmd.SkipRegistryCheck.Name, false, "Skip the Docker daemon registry check.")470 clusterUpFlagSet.String(configCmd.PublicHostname.Name, "", "Public hostname of the OpenShift cluster.")471 clusterUpFlagSet.String(configCmd.RoutingSuffix.Name, "", "Default suffix for the server routes.")472 clusterUpFlagSet.String(configCmd.HostConfigDir.Name, hostConfigDirectory, "Location of the OpenShift configuration on the Docker host.")473 clusterUpFlagSet.String(configCmd.HostVolumeDir.Name, hostVolumesDirectory, "Location of the OpenShift volumes on the Docker host.")474 clusterUpFlagSet.String(configCmd.HostDataDir.Name, hostDataDirectory, "Location of the OpenShift data on the Docker host. If not specified, etcd data will not be persisted on the host.")475 clusterUpFlagSet.String(configCmd.HostPvDir.Name, hostPvDirectory, "Directory on Docker host for OpenShift persistent volumes")476 clusterUpFlagSet.Int(configCmd.ServerLogLevel.Name, 0, "Log level for the OpenShift server.")477 clusterUpFlagSet.StringSliceVarP(&openShiftEnv, configCmd.OpenshiftEnv.Name, "e", []string{}, "Specify key-value pairs of environment variables to set on the OpenShift container.")478 clusterUpFlagSet.Bool(configCmd.Metrics.Name, false, "Install metrics (experimental)")479 clusterUpFlagSet.Bool(configCmd.Logging.Name, false, "Install logging (experimental)")480 clusterUpFlagSet.String(configCmd.OpenshiftVersion.Name, version.GetOpenShiftVersion(), fmt.Sprintf("The OpenShift version to run, eg. %s", version.GetOpenShiftVersion()))481 clusterUpFlagSet.String(configCmd.NoProxyList.Name, "", "List of hosts or subnets for which no proxy should be used.")482 clusterUpFlagSet.AddFlag(cmdUtil.HttpProxyFlag)483 clusterUpFlagSet.AddFlag(cmdUtil.HttpsProxyFlag)484 if minishiftConfig.EnableExperimental {485 clusterUpFlagSet.Bool(configCmd.ServiceCatalog.Name, false, "Install service catalog (experimental)")486 clusterUpFlagSet.String(configCmd.ExtraClusterUpFlags.Name, "", "Specify optional flags for use with 'cluster up' (unsupported)")487 }488 return clusterUpFlagSet489}490// initSubscriptionManagerFlags create the CLI flags which are needed for VM registration491func initSubscriptionManagerFlags() *flag.FlagSet {492 subscriptionManagerFlagSet := flag.NewFlagSet(commandName, flag.ContinueOnError)493 subscriptionManagerFlagSet.String(configCmd.Username.Name, "", "Username for the virtual machine registration.")494 subscriptionManagerFlagSet.String(configCmd.Password.Name, "", "Password for the virtual machine registration.")495 subscriptionManagerFlagSet.BoolVar(&registrationUtil.SkipRegistration, configCmd.SkipRegistration.Name, false, "Skip the virtual machine registration.")496 return subscriptionManagerFlagSet497}498// determineClusterUpParameters returns a map of flag names and values for the cluster up call.499func determineClusterUpParameters(config *clusterup.ClusterUpConfig) map[string]string {500 clusterUpParams := make(map[string]string)501 // Set default value for host config, data and volumes502 viper.Set(configCmd.HostConfigDir.Name, viper.GetString(configCmd.HostConfigDir.Name))503 viper.Set(configCmd.HostDataDir.Name, viper.GetString(configCmd.HostDataDir.Name))504 viper.Set(configCmd.HostVolumeDir.Name, viper.GetString(configCmd.HostVolumeDir.Name))505 viper.Set(configCmd.HostPvDir.Name, viper.GetString(configCmd.HostPvDir.Name))506 viper.Set(configCmd.RoutingSuffix.Name, config.RoutingSuffix)507 clusterUpFlagSet.VisitAll(func(flag *flag.Flag) {508 if viper.IsSet(flag.Name) {509 value := viper.GetString(flag.Name)510 key := flag.Name511 _, exists := minishiftToClusterUp[key]512 if exists {513 key = minishiftToClusterUp[key]514 }515 clusterUpParams[key] = value516 }517 })518 return clusterUpParams519}520func getDefaultRoutingPrefix(ip string) string {521 // prefer nip.io over xip.io. See GitHub issue #501522 if viper.IsSet(configCmd.RoutingSuffix.Name) {523 return viper.GetString(configCmd.RoutingSuffix.Name)524 } else {525 return ip + ".nip.io"526 }527}528func ensureNotRunning(client *libmachine.Client, machineName string) {529 if !cmdUtil.VMExists(client, machineName) {530 return531 }532 hostVm, err := client.Load(constants.MachineName)533 if err != nil {534 atexit.ExitWithMessage(1, err.Error())535 }536 if cmdUtil.IsHostRunning(hostVm.Driver) {537 atexit.ExitWithMessage(0, fmt.Sprintf("The '%s' VM is already running.", machineName))538 }539}540func validateOpenshiftVersion() {541 requestedVersion := viper.GetString(configCmd.OpenshiftVersion.Name)542 valid, err := openshiftVersion.IsGreaterOrEqualToBaseVersion(requestedVersion, constants.MinimumSupportedOpenShiftVersion)543 if err != nil {544 atexit.ExitWithMessage(1, err.Error())545 }546 if !valid {547 fmt.Printf("Minishift does not support OpenShift version %s. "+548 "You need to use a version >= %s\n", viper.GetString(configCmd.OpenshiftVersion.Name),549 constants.MinimumSupportedOpenShiftVersion)550 atexit.Exit(1)551 }552 // Make sure the version actually has a 'v' prefix. See https://github.com/minishift/minishift/issues/410553 if !strings.HasPrefix(requestedVersion, constants.VersionPrefix) {554 requestedVersion = constants.VersionPrefix + requestedVersion555 // this will make sure the right version is set in case the version comes from config file556 viper.Set(configCmd.OpenshiftVersion.Name, requestedVersion)557 // if the version was specified via the CLI we need to update the flag value558 startCmd.Flags().Lookup(configCmd.OpenshiftVersion.Name).Value.Set(requestedVersion)559 }560}561func setSubscriptionManagerParameters() {562 minishiftCluster.RegistrationParameters.Username = viper.GetString(configCmd.Username.Name)563 minishiftCluster.RegistrationParameters.Password = viper.GetString(configCmd.Password.Name)564 minishiftCluster.RegistrationParameters.IsTtySupported = util.IsTtySupported()565 minishiftCluster.RegistrationParameters.GetUsernameInteractive = getUsernameInteractive566 minishiftCluster.RegistrationParameters.GetPasswordInteractive = getPasswordInteractive567}568func getUsernameInteractive(message string) string {569 return util.ReadInputFromStdin(message)570}571func getPasswordInteractive(message string) string {572 return util.ReadPasswordFromStdin(message)573}574func applyDockerEnvToProcessEnv(libMachineClient *libmachine.Client) {575 // Making sure the required Docker environment variables are set to make 'cluster up' work576 envMap, err := cluster.GetHostDockerEnv(libMachineClient)577 for k, v := range envMap {578 os.Setenv(k, v)579 }580 if err != nil {581 atexit.ExitWithMessage(1, fmt.Sprintf("Error determining Docker settings: %v", err))582 }583}584func IsOpenShiftRunning(driver drivers.Driver) bool {585 sshCommander := provision.GenericSSHCommander{Driver: driver}...

Full Screen

Full Screen

common.go

Source:common.go Github

copy

Full Screen

...215 }216 secOpts.ServerRootCAs = [][]byte{caPEM}217 }218 if secOpts.RequireClientCert {219 secOpts.Key, secOpts.Certificate, err = getClientAuthInfoFromEnv(prefix)220 if err != nil {221 return222 }223 }224 clientConfig.SecOpts = secOpts225 return226}227// getClientAuthInfoFromEnv reads client tls key file and cert file and returns the bytes for the files228func getClientAuthInfoFromEnv(prefix string) ([]byte, []byte, error) {229 keyPEM, err := ioutil.ReadFile(config.GetPath(prefix + ".tls.clientKey.file"))230 if err != nil {231 return nil, nil, errors.WithMessagef(err, "unable to load %s.tls.clientKey.file", prefix)232 }233 certPEM, err := ioutil.ReadFile(config.GetPath(prefix + ".tls.clientCert.file"))234 if err != nil {235 return nil, nil, errors.WithMessagef(err, "unable to load %s.tls.clientCert.file", prefix)236 }237 return keyPEM, certPEM, nil238}239func InitCmd(cmd *cobra.Command, args []string) {240 err := InitConfig(CmdRoot)241 if err != nil { // Handle errors reading the config file242 mainLogger.Errorf("Fatal error when initializing %s config : %s", CmdRoot, err)...

Full Screen

Full Screen

prow_test.go

Source:prow_test.go Github

copy

Full Screen

...205 o.Options.Repos = []string{"test/repo"}206 o.Kind = prow.Application207 err := o.AddProwConfig()208 assert.NoError(t, err)209 // now lets get the release job210 names, err := o.GetReleaseJobs()211 assert.NotEmpty(t, names, err)212 assert.Equal(t, "test/repo/master", names[0])213}214func TestGetBuildSpec(t *testing.T) {215 t.Parallel()216 o := TestOptions{}217 o.Setup()218 o.Options.Repos = []string{"test/repo"}219 o.Kind = prow.Application220 err := o.AddProwConfig()221 assert.NoError(t, err)222 // now lets get the release job223 buildSpec, err := o.GetBuildSpec("test", "repo", "master")224 assert.NotEmpty(t, buildSpec, err)225}...

Full Screen

Full Screen

settings.go

Source:settings.go Github

copy

Full Screen

1package engine2import (3 "fmt"4 "path/filepath"5 "strings"6 "golang.org/x/time/rate"7 "github.com/anacrolix/dht"8 "github.com/anacrolix/torrent"9 "github.com/sirupsen/logrus"10 "github.com/spf13/viper"11)12//FullClientSettings contains all of the settings for our entire application13type FullClientSettings struct {14 LoggingLevel logrus.Level15 LoggingOutput string16 HTTPAddr string17 HTTPAddrIP string18 UseProxy bool19 WebsocketClientPort string20 BaseURL string21 Version int22 TorrentConfig torrent.Config23 TFileUploadFolder string24 SeedRatioStop float6425 PushBulletToken string26 DefaultMoveFolder string27 TorrentWatchFolder string28}29//default is called if there is a parsing error30func defaultConfig() FullClientSettings {31 var Config FullClientSettings32 Config.Version = 1.033 Config.LoggingLevel = 3 //Warn level34 Config.TorrentConfig.DataDir = "downloads" //the absolute or relative path of the default download directory for torrents35 Config.TFileUploadFolder = "uploadedTorrents"36 Config.TorrentConfig.Seed = true37 Config.HTTPAddr = ":8000"38 Config.SeedRatioStop = 1.5039 Config.TorrentConfig.DHTConfig = dht.ServerConfig{40 StartingNodes: dht.GlobalBootstrapAddrs,41 }42 return Config43}44func dhtServerSettings(dhtConfig dht.ServerConfig) dht.ServerConfig {45 viper.UnmarshalKey("DHTConfig", &dhtConfig)46 Logger.WithFields(logrus.Fields{"dhtConfig": dhtConfig}).Info("Displaying DHT Config")47 return dhtConfig48}49func calculateRateLimiters(uploadRate, downloadRate string) (*rate.Limiter, *rate.Limiter) { //TODO reorg50 var uploadRateLimiterSize int51 var downloadRateLimiterSize int52 switch uploadRate {53 case "Low":54 uploadRateLimiterSize = 5000055 case "Medium":56 uploadRateLimiterSize = 50000057 case "High":58 uploadRateLimiterSize = 150000059 default:60 downloadRateLimiter := rate.NewLimiter(rate.Inf, 0)61 uploadRateLimiter := rate.NewLimiter(rate.Inf, 0)62 return downloadRateLimiter, uploadRateLimiter63 }64 switch downloadRate {65 case "Low":66 downloadRateLimiterSize = 5000067 case "Medium":68 downloadRateLimiterSize = 50000069 case "High":70 downloadRateLimiterSize = 150000071 default:72 downloadRateLimiter := rate.NewLimiter(rate.Inf, 0)73 uploadRateLimiter := rate.NewLimiter(rate.Inf, 0)74 return downloadRateLimiter, uploadRateLimiter75 }76 var limitPerSecondUl = rate.Limit(uploadRateLimiterSize)77 uploadRateLimiter := rate.NewLimiter(limitPerSecondUl, uploadRateLimiterSize)78 var limitPerSecondDl = rate.Limit(uploadRateLimiterSize)79 downloadRateLimiter := rate.NewLimiter(limitPerSecondDl, downloadRateLimiterSize)80 return downloadRateLimiter, uploadRateLimiter81}82//FullClientSettingsNew creates a new set of setting from config.toml83func FullClientSettingsNew() FullClientSettings {84 viper.SetConfigName("config")85 viper.AddConfigPath("./")86 err := viper.ReadInConfig()87 if err != nil {88 fmt.Println("Error reading in config, using defaults", err)89 FullClientSettings := defaultConfig()90 return FullClientSettings91 }92 var httpAddr string93 var baseURL string94 var websocketClientPort string95 httpAddrIP := viper.GetString("serverConfig.ServerAddr")96 httpAddrPort := viper.GetString("serverConfig.ServerPort")97 proxySet := viper.GetBool("reverseProxy.ProxyEnabled")98 websocketClientPort = strings.TrimLeft(viper.GetString("serverConfig.ServerPort"), ":") //Trimming off the colon in front of the port99 if proxySet {100 baseURL = viper.GetString("reverseProxy.BaseURL")101 fmt.Println("WebsocketClientPort", viper.GetString("serverConfig.ServerPort"))102 }103 seedRatioStop := viper.GetFloat64("serverConfig.SeedRatioStop")104 httpAddr = httpAddrIP + httpAddrPort105 pushBulletToken := viper.GetString("notifications.PushBulletToken")106 defaultMoveFolder := filepath.ToSlash(viper.GetString("serverConfig.DefaultMoveFolder")) //Converting the string literal into a filepath107 defaultMoveFolderAbs, err := filepath.Abs(defaultMoveFolder)108 if err != nil {109 fmt.Println("Failed creating absolute path for defaultMoveFolder", err)110 }111 torrentWatchFolder := filepath.ToSlash(viper.GetString("serverConfig.TorrentWatchFolder"))112 torrentWatchFolderAbs, err := filepath.Abs(torrentWatchFolder)113 if err != nil {114 fmt.Println("Failed creating absolute path for torrentWatchFolderAbs", err)115 }116 dataDir := filepath.ToSlash(viper.GetString("torrentClientConfig.DownloadDir")) //Converting the string literal into a filepath117 dataDirAbs, err := filepath.Abs(dataDir) //Converting to an absolute file path118 if err != nil {119 fmt.Println("Failed creating absolute path for dataDir", err)120 }121 var uploadRateLimiter *rate.Limiter122 var downloadRateLimiter *rate.Limiter123 uploadRate := viper.GetString("serverConfig.UploadRateLimit")124 downloadRate := viper.GetString("serverConfig.DownloadRateLimit")125 downloadRateLimiter, uploadRateLimiter = calculateRateLimiters(uploadRate, downloadRate)126 listenAddr := viper.GetString("torrentClientConfig.ListenAddr")127 disablePex := viper.GetBool("torrentClientConfig.DisablePEX")128 noDHT := viper.GetBool("torrentClientConfig.NoDHT")129 noUpload := viper.GetBool("torrentClientConfig.NoUpload")130 seed := viper.GetBool("torrentClientConfig.Seed")131 peerID := viper.GetString("torrentClientConfig.PeerID")132 disableUTP := viper.GetBool("torrentClientConfig.DisableUTP")133 disableTCP := viper.GetBool("torrentClientConfig.DisableTCP")134 disableIPv6 := viper.GetBool("torrentClientConfig.DisableIPv6")135 debug := viper.GetBool("torrentClientConfig.Debug")136 logLevelString := viper.GetString("serverConfig.LogLevel")137 logOutput := viper.GetString("serverConfig.LogOutput")138 var logLevel logrus.Level139 switch logLevelString { //Options = Debug 5, Info 4, Warn 3, Error 2, Fatal 1, Panic 0140 case "Panic":141 logLevel = 0142 case "Fatal":143 logLevel = 1144 case "Error":145 logLevel = 2146 case "Warn":147 logLevel = 3148 case "Info":149 logLevel = 4150 case "Debug":151 logLevel = 5152 default:153 logLevel = 3154 }155 dhtServerConfig := dht.ServerConfig{156 StartingNodes: dht.GlobalBootstrapAddrs,157 }158 if viper.IsSet("DHTConfig") {159 fmt.Println("Reading in custom DHT config")160 dhtServerConfig = dhtServerSettings(dhtServerConfig)161 }162 encryptionPolicy := torrent.EncryptionPolicy{163 DisableEncryption: viper.GetBool("EncryptionPolicy.DisableEncryption"),164 ForceEncryption: viper.GetBool("EncryptionPolicy.ForceEncryption"),165 PreferNoEncryption: viper.GetBool("EncryptionPolicy.PreferNoEncryption"),166 }167 tConfig := torrent.Config{168 DataDir: dataDirAbs,169 ListenAddr: listenAddr,170 DisablePEX: disablePex,171 NoDHT: noDHT,172 DHTConfig: dhtServerConfig,173 NoUpload: noUpload,174 Seed: seed,175 UploadRateLimiter: uploadRateLimiter,176 DownloadRateLimiter: downloadRateLimiter,177 PeerID: peerID,178 DisableUTP: disableUTP,179 DisableTCP: disableTCP,180 DisableIPv6: disableIPv6,181 Debug: debug,182 EncryptionPolicy: encryptionPolicy,183 }184 Config := FullClientSettings{185 LoggingLevel: logLevel,186 LoggingOutput: logOutput,187 SeedRatioStop: seedRatioStop,188 HTTPAddr: httpAddr,189 HTTPAddrIP: httpAddrIP,190 UseProxy: proxySet,191 WebsocketClientPort: websocketClientPort,192 TorrentConfig: tConfig,193 BaseURL: baseURL,194 TFileUploadFolder: "uploadedTorrents",195 PushBulletToken: pushBulletToken,196 DefaultMoveFolder: defaultMoveFolderAbs,197 TorrentWatchFolder: torrentWatchFolderAbs,198 }199 return Config200}...

Full Screen

Full Screen

config.go

Source:config.go Github

copy

Full Screen

1/*2Copyright 2020 The Knative Authors3Licensed under the Apache License, Version 2.0 (the "License");4you may not use this file except in compliance with the License.5You may obtain a copy of the License at6 http://www.apache.org/licenses/LICENSE-2.07Unless required by applicable law or agreed to in writing, software8distributed under the License is distributed on an "AS IS" BASIS,9WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.10See the License for the specific language governing permissions and11limitations under the License.12*/13package adapter14import (15 "encoding/json"16 "os"17 "strconv"18 "time"19 "go.uber.org/zap"20 duckv1 "knative.dev/pkg/apis/duck/v1"21 kle "knative.dev/pkg/leaderelection"22 "knative.dev/pkg/logging"23 "knative.dev/pkg/metrics"24 "knative.dev/pkg/tracing"25 tracingconfig "knative.dev/pkg/tracing/config"26)27type EnvConfigConstructor func() EnvConfigAccessor28const (29 EnvConfigComponent = "K_COMPONENT"30 EnvConfigNamespace = "NAMESPACE"31 EnvConfigName = "NAME"32 EnvConfigResourceGroup = "K_RESOURCE_GROUP"33 EnvConfigSink = "K_SINK"34 EnvConfigCEOverrides = "K_CE_OVERRIDES"35 EnvConfigMetricsConfig = "K_METRICS_CONFIG"36 EnvConfigLoggingConfig = "K_LOGGING_CONFIG"37 EnvConfigTracingConfig = "K_TRACING_CONFIG"38 EnvConfigLeaderElectionConfig = "K_LEADER_ELECTION_CONFIG"39 EnvSinkTimeout = "K_SINK_TIMEOUT"40)41// EnvConfig is the minimal set of configuration parameters42// source adapters should support.43type EnvConfig struct {44 // Component is the kind of this adapter.45 Component string `envconfig:"K_COMPONENT"`46 // Environment variable containing the namespace of the adapter.47 Namespace string `envconfig:"NAMESPACE"`48 // Environment variable containing the name of the adapter.49 Name string `envconfig:"NAME" default:"adapter"`50 // Environment variable containing the resource group of the adapter for metrics.51 ResourceGroup string `envconfig:"K_RESOURCE_GROUP" default:"adapter.sources.knative.dev"`52 // Sink is the URI messages will be sent.53 Sink string `envconfig:"K_SINK"`54 // CEOverrides are the CloudEvents overrides to be applied to the outbound event.55 CEOverrides string `envconfig:"K_CE_OVERRIDES"`56 // MetricsConfigJson is a json string of metrics.ExporterOptions.57 // This is used to configure the metrics exporter options,58 // the config is stored in a config map inside the controllers59 // namespace and copied here.60 MetricsConfigJson string `envconfig:"K_METRICS_CONFIG" default:"{}"`61 // LoggingConfigJson is a json string of logging.Config.62 // This is used to configure the logging config, the config is stored in63 // a config map inside the controllers namespace and copied here.64 LoggingConfigJson string `envconfig:"K_LOGGING_CONFIG" default:"{}"`65 // TracingConfigJson is a json string of tracing.Config.66 // This is used to configure the tracing config, the config is stored in67 // a config map inside the controllers namespace and copied here.68 // Default is no-op.69 TracingConfigJson string `envconfig:"K_TRACING_CONFIG"`70 // LeaderElectionConfigJson is the leader election component configuration.71 LeaderElectionConfigJson string `envconfig:"K_LEADER_ELECTION_CONFIG"`72 // Time in seconds to wait for sink to respond73 EnvSinkTimeout string `envconfig:"K_SINK_TIMEOUT"`74 // cached zap logger75 logger *zap.SugaredLogger76}77// EnvConfigAccessor defines accessors for the minimal78// set of source adapter configuration parameters.79type EnvConfigAccessor interface {80 // Set the component name.81 SetComponent(string)82 // Get the URI where messages will be forwarded to.83 GetSink() string84 // Get the namespace of the adapter.85 GetNamespace() string86 // Get the name of the adapter.87 GetName() string88 // Get the parsed metrics.ExporterOptions.89 GetMetricsConfig() (*metrics.ExporterOptions, error)90 // Get the parsed logger.91 GetLogger() *zap.SugaredLogger92 SetupTracing(*zap.SugaredLogger) error93 GetCloudEventOverrides() (*duckv1.CloudEventOverrides, error)94 // GetLeaderElectionConfig returns leader election configuration.95 GetLeaderElectionConfig() (*kle.ComponentConfig, error)96 // Get the timeout to apply on a request to a sink97 GetSinktimeout() int98}99var _ EnvConfigAccessor = (*EnvConfig)(nil)100func (e *EnvConfig) SetComponent(component string) {101 e.Component = component102}103func (e *EnvConfig) GetMetricsConfig() (*metrics.ExporterOptions, error) {104 // Convert json metrics.ExporterOptions to metrics.ExporterOptions.105 metricsConfig, err := metrics.JSONToOptions(e.MetricsConfigJson)106 if err != nil {107 return nil, err108 }109 return metricsConfig, err110}111func (e *EnvConfig) GetLogger() *zap.SugaredLogger {112 if e.logger == nil {113 loggingConfig, err := logging.JSONToConfig(e.LoggingConfigJson)114 if err != nil {115 // Use default logging config.116 if loggingConfig, err = logging.NewConfigFromMap(map[string]string{}); err != nil {117 // If this fails, there is no recovering.118 panic(err)119 }120 }121 logger, _ := logging.NewLoggerFromConfig(loggingConfig, e.Component)122 e.logger = logger123 }124 return e.logger125}126func (e *EnvConfig) GetSink() string {127 return e.Sink128}129func (e *EnvConfig) GetNamespace() string {130 return e.Namespace131}132func (e *EnvConfig) GetName() string {133 return e.Name134}135func (e *EnvConfig) GetSinktimeout() int {136 if duration, err := strconv.Atoi(e.EnvSinkTimeout); err == nil {137 return duration138 }139 e.GetLogger().Warn("Sink timeout configuration is invalid, default to -1 (no timeout)")140 return -1141}142func (e *EnvConfig) SetupTracing(logger *zap.SugaredLogger) error {143 config, err := tracingconfig.JSONToTracingConfig(e.TracingConfigJson)144 if err != nil {145 logger.Warn("Tracing configuration is invalid, using the no-op default", zap.Error(err))146 }147 return tracing.SetupStaticPublishing(logger, "", config)148}149func (e *EnvConfig) GetCloudEventOverrides() (*duckv1.CloudEventOverrides, error) {150 var ceOverrides duckv1.CloudEventOverrides151 if len(e.CEOverrides) > 0 {152 err := json.Unmarshal([]byte(e.CEOverrides), &ceOverrides)153 if err != nil {154 return nil, err155 }156 }157 return &ceOverrides, nil158}159func (e *EnvConfig) GetLeaderElectionConfig() (*kle.ComponentConfig, error) {160 if e.LeaderElectionConfigJson == "" {161 return e.defaultLeaderElectionConfig(), nil162 }163 var config kle.ComponentConfig164 if err := json.Unmarshal([]byte(e.LeaderElectionConfigJson), &config); err != nil {165 return e.defaultLeaderElectionConfig(), err166 }167 config.Component = e.Component168 return &config, nil169}170func (e *EnvConfig) defaultLeaderElectionConfig() *kle.ComponentConfig {171 return &kle.ComponentConfig{172 Component: e.Component,173 Buckets: 1,174 LeaseDuration: 15 * time.Second,175 RenewDeadline: 10 * time.Second,176 RetryPeriod: 2 * time.Second,177 }178}179// LeaderElectionComponentConfigToJSON converts a ComponentConfig to a json string.180func LeaderElectionComponentConfigToJSON(cfg *kle.ComponentConfig) (string, error) {181 if cfg == nil {182 return "", nil183 }184 jsonCfg, err := json.Marshal(cfg)185 return string(jsonCfg), err186}187func GetSinkTimeout(logger *zap.SugaredLogger) int {188 str := os.Getenv(EnvSinkTimeout)189 if str != "" {190 var err error191 duration, err := strconv.Atoi(str)192 if err != nil || duration < 0 {193 if logger != nil {194 logger.Errorf("%s environment value is invalid. It must be a integer greater than zero. (got %s)", EnvSinkTimeout, str)195 }196 return -1197 }198 return duration199 }200 return -1201}...

Full Screen

Full Screen

config_test.go

Source:config_test.go Github

copy

Full Screen

1// Copyright 2013 Google, Inc. All rights reserved.2//3// Licensed under the Apache License, Version 2.0 (the "License");4// you may not use this file except in compliance with the License.5// You may obtain a copy of the License at6//7// http://www.apache.org/licenses/LICENSE-2.08//9// Unless required by applicable law or agreed to in writing, software10// distributed under the License is distributed on an "AS IS" BASIS,11// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.12// See the License for the specific language governing permissions and13// limitations under the License.14package yaml15import (16 "testing"17)18var dummyConfigFile = `19mapping:20 key1: value121 key2: value222 key3: 523 key4: true24 key5: false25list:26 - item127 - item228config:29 server:30 - www.google.com31 - www.cnn.com32 - www.example.com33 admin:34 - username: god35 password: z3u536 - username: lowly37 password: f!r3m338`39var configGetTests = []struct {40 Spec string41 Want string42 Err string43}{44 {"mapping.key1", "value1", ""},45 {"mapping.key2", "value2", ""},46 {"list[0]", "item1", ""},47 {"list[1]", "item2", ""},48 {"list", "", `yaml: list: type mismatch: "list" is yaml.List, want yaml.Scalar (at "$")`},49 {"list.0", "", `yaml: .list.0: type mismatch: ".list" is yaml.List, want yaml.Map (at ".0")`},50 {"config.server[0]", "www.google.com", ""},51 {"config.server[1]", "www.cnn.com", ""},52 {"config.server[2]", "www.example.com", ""},53 {"config.server[3]", "", `yaml: .config.server[3]: ".config.server[3]" not found`},54 {"config.listen[0]", "", `yaml: .config.listen[0]: ".config.listen" not found`},55 {"config.admin[0].username", "god", ""},56 {"config.admin[1].username", "lowly", ""},57 {"config.admin[2].username", "", `yaml: .config.admin[2].username: ".config.admin[2]" not found`},58}59func TestGet(t *testing.T) {60 config := Config(dummyConfigFile)61 for _, test := range configGetTests {62 got, err := config.Get(test.Spec)63 if want := test.Want; got != want {64 t.Errorf("Get(%q) = %q, want %q", test.Spec, got, want)65 }66 switch err {67 case nil:68 got = ""69 default:70 got = err.Error()71 }72 if want := test.Err; got != want {73 t.Errorf("Get(%q) error %#q, want %#q", test.Spec, got, want)74 }75 }76 i, err := config.GetInt("mapping.key3")77 if err != nil || i != 5 {78 t.Errorf("GetInt mapping.key3 wrong")79 }80 b, err := config.GetBool("mapping.key4")81 if err != nil || b != true {82 t.Errorf("GetBool mapping.key4 wrong")83 }84 b, err = config.GetBool("mapping.key5")85 if err != nil || b != false {86 t.Errorf("GetBool mapping.key5 wrong")87 }88}...

Full Screen

Full Screen

get

Using AI Code Generation

copy

Full Screen

1import (2func main() {3 conf, err := config.NewConfig("ini", "config.conf")4 if err != nil {5 fmt.Println("new config failed, err:", err)6 }7 port, err := conf.Int("server::port")8 if err != nil {9 fmt.Println("read server::port failed, err:", err)10 }11 fmt.Println("port:", port)12}13import (14func main() {15 conf, err := config.NewConfig("ini", "config.conf")16 if err != nil {17 fmt.Println("new config failed, err:", err)18 }19 port, err := conf.Int("server::port")20 if err != nil {21 fmt.Println("read server::port failed, err:", err)22 }23 fmt.Println("port:", port)24 conf.Set("server::port", "9090")25 port, err = conf.Int("server::port")26 if err != nil {27 fmt.Println("read server::port failed, err:", err)28 }29 fmt.Println("port:", port)30}31import (32func main() {33 conf, err := config.NewConfig("ini", "config.conf")34 if err != nil {35 fmt.Println("new config failed, err:", err)36 }37 port, err := conf.Int("server::port")38 if err != nil {39 fmt.Println("read server::port failed, err:", err)40 }41 fmt.Println("port:", port)

Full Screen

Full Screen

get

Using AI Code Generation

copy

Full Screen

1import (2func main() {3 config := config.NewConfig()4 config.Set("name", "steve")5 fmt.Println(config.Get("name"))6}7import (8type Config struct {9 data map[string]interface{}10}11func NewConfig() *Config {12 return &Config{13 data: make(map[string]interface{}),14 }15}16func (c *Config) Set(key string, value interface{}) {17 c.Lock()18 defer c.Unlock()19}20func (c *Config) Get(key string) interface{} {21 c.RLock()22 defer c.RUnlock()23}

Full Screen

Full Screen

get

Using AI Code Generation

copy

Full Screen

1import (2func main() {3 fmt.Println(config.Get("key1"))4}5import (6type Config struct {7}8func (c *Config) Get(key string) string {9}10func NewConfig() *Config {11 c := &Config{}12 c.config = make(map[string]string)13 c.loadConfig()14}15func (c *Config) loadConfig() {16 file, err := os.Open("config.txt")17 if err != nil {18 log.Fatal(err)19 }20 defer file.Close()21 scanner := bufio.NewScanner(file)22 for scanner.Scan() {23 line := scanner.Text()24 pair := strings.Split(line, "=")25 }26 if err := scanner.Err(); err != nil {27 log.Fatal(err)28 }29}30func main() {31 c := NewConfig()32 fmt.Println(c.Get("key1"))33}34import (35type Config struct {36}37func (c *Config) Get(key string) string {38}39func NewConfig() *Config {40 c := &Config{}41 c.config = make(map[string]string)42 c.loadConfig()43}44func (c *Config) loadConfig() {45 file, err := os.Open("config.txt")46 if err != nil {47 log.Fatal(err)48 }49 defer file.Close()50 scanner := bufio.NewScanner(file)51 for scanner.Scan() {52 line := scanner.Text()53 pair := strings.Split(line, "=")54 }55 if err := scanner.Err(); err != nil {56 log.Fatal(err)57 }58}59func main() {60 c := NewConfig()

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.

Try LambdaTest Now !!

Get 100 minutes of automation test minutes FREE!!

Next-Gen App & Browser Testing Cloud

Was this article helpful?

Helpful

NotHelpful