YAML

一篇文章为你揭秘pytest的基本用法

梦想与她 提交于 2021-02-12 04:44:38
pytest是一个测试框架,功能与unittest类似,完全兼容unittest的功能。一般做接口测试的时候,以前用的多的是python+requests+httptestrunner完成接口自动化测试与报告生成,看到现在很多都在用pytest框架,我也来学习一下,接口测试中pytest应用广泛的是通过python+pytest+allure生成测试报告,报告格式比较美观。 文章比较长,先简单概述一下本文的大概内容: 1、环境搭建以及pytest是怎么运行的,如何识别有效用例 2、用例执行顺序、参数传递、数据驱动 3、断言,以及常见的pytest装饰器 4、测试报告生成,包括自带的pytest的报告以及集成allure的报告。 pytest安装 pip install -U pytest 查看安装版本: cmd窗口输入:pytest --version ,会在窗口中输出类似下面格式的一句话: This is pytest version 5.4.3, imported from d:\python38\lib\site-packages\pytest\__init__.py 用例的识别与运行 用例编写规范 测试文件以test_开头(或者以_test结尾) pytest会找当前以及递归查找子文件夹下面所有的test_*.py或*_test.py的文件,把其当作测试文件

Kubernetes集群中Service的滚动更新

喜你入骨 提交于 2021-02-12 04:17:57
Kubernetes集群中Service的滚动更新 二月 9, 2017 0 条评论 在移动互联网时代,消费者的消费行为已经“全天候化”,为此,商家的业务系统也要保持7×24小时不间断地提供服务以满足消费者的需求。很难想像如今还会有以“中断业务”为前提的服务系统更新升级。如果 微信 官方发布公告说:每周六晚23:00~次日凌晨2:00进行例行系统升级,不能提供服务,作为用户的你会怎么想、怎么做呢?因此,各个平台在最初设计时就要考虑到服务的更新升级问题,部署在 Kubernetes集群 中的Service也不例外。 一、预备知识 1、滚动更新Rolling-update 传统的升级更新,是先将服务全部下线,业务停止后再更新版本和配置,然后重新启动并提供服务。这样的模式已经完全不能满足“时代的需要”了。在并发化、高可用系统普及的今天,服务的升级更新至少要做到“业务不中断”。而滚动更新(Rolling-update)恰是满足这一需求的一种系统更新升级方案。 简单来说,滚动更新就是针对多实例服务的一种不中断服务的更新升级方式。一般情况,对于多实例服务,滚动更新采用对各个实例逐个进行单独更新而非同一时刻对所有实例进行全部更新的方式。“滚动更新”的先进之处在于“滚动”这个概念的引入,笔者觉得它至少有以下两点含义: a) “滚动”给人一种“圆”的映像,表意:持续,不中断。“滚动”的理念是一种趋势

Setting build number format conditionally

隐身守侯 提交于 2021-02-11 18:19:57
问题 I'm using the YML file and i'm trying to set the build number format using the following snippet, but I'm not quite sure how to get the `Build.SourceBranch' into the formatting. I've tried to use $(Build.SourceBranch) ... (Build.SourceBranch) and Build.SourceBranch I'm attempting to set the output to look like 20190220-create-yaml.2 etc for when it's a feature feature branch. and just 20190220.3 when it's a master branch. variables: ${{ if ne(variables['Build.SourceBranch'], 'master') }}:

Setting build number format conditionally

筅森魡賤 提交于 2021-02-11 18:18:13
问题 I'm using the YML file and i'm trying to set the build number format using the following snippet, but I'm not quite sure how to get the `Build.SourceBranch' into the formatting. I've tried to use $(Build.SourceBranch) ... (Build.SourceBranch) and Build.SourceBranch I'm attempting to set the output to look like 20190220-create-yaml.2 etc for when it's a feature feature branch. and just 20190220.3 when it's a master branch. variables: ${{ if ne(variables['Build.SourceBranch'], 'master') }}:

SnakeYaml get stacked keys

淺唱寂寞╮ 提交于 2021-02-11 16:51:26
问题 When this is my .yml file: test1: "string1" test2: test3: "string2" How do I get the value of test3 ? Map<String, Object> yamlFile = new Yaml().load(YamlFileInputStream); yamlFile.get("test1"); // output: string1 yamlFile.get("test2"); // output: {test3=string2} yamlFile.get("test2.test3"); // output: key not found 回答1: YAML does not have „stacked keys“ . It has nested mappings. The dot . is not a special character and can occur normally in a key, therefore you cannot use it for querying

How can I specify different concurrency queues for sidekiq configuration?

落花浮王杯 提交于 2021-02-11 15:23:27
问题 I have the following sidekiq.yml config file, but I'm not sure how to build a separate queue with lower concurrency. How can I do this? --- :concurrency: 25 :pidfile: ./tmp/pids/sidekiq.pid :logfile: ./log/sidekiq.log :queues: - default - [high_priority, 2] - [import_queue, 3] - [user_queue, 4] :daemon: true I would like to do something like the following though, --- :concurrency: 25 :pidfile: ./tmp/pids/sidekiq.pid :logfile: ./log/sidekiq.log :queues: - default - [high_priority, 2] - [import

How to parse YAML file to a Java class

随声附和 提交于 2021-02-11 14:36:20
问题 I have a class Recipe that represents this YAML block: id: Ex1 uses: - Database: ["D1", "D2"] - MetaFeature: ["M1", "M2"] - Algorithm: ["A1", "A2"] - Config: ["C1", "C4"] public class Recipe { private String id; private HashMap<String, HashSet<String>> uses; } Is there a way to parse this YAML to Recipe class without creating other classes or doing some tricks? 回答1: Firs of all, you have to include SnakeYML as dependency in maven pom.xml. I provide below the maven dependency for snakeyml.

How do I resolve an error in my yaml file?

给你一囗甜甜゛ 提交于 2021-02-11 14:24:03
问题 I'm trying to install docker on a node using an ansible playbook, but I keep getting an error. Here's the playbook --- - host: all become: yes become_user: root tasks: - name Add Docker GPG key apt_key: url=https://download.docker.com/linux/ubuntu/gpg - name: Add Docker APT repository apt_repository: repo: deb [arch=and64] https://download.docker.com/linux/ubuntu {{ansible_distributionrelease}} stable - name: Install list of packages apt: name: "{{item}}" state: installed update_cache: yes

Load multiple yaml file with same root key in spring boot

本秂侑毒 提交于 2021-02-11 13:01:45
问题 I'm looking for a solution in spring boot where I can maintain same root key in multiple files and load it to a POJO. application-profile-1.yml active: configuration: - name: abc ....... (1000 lines in config) application-profile-2.yml active: configuration: - name: xyz ....... (900 lines in config) application-profile-3.yml active: configuration: - name: abc ....... (700 lines in config) application.yml spring.profiles.include: profile-1,profile-2,profile-3 @ConfigurationProperties(prefix =

Azure Pipelines YAML: Unexpected value 'variables' and Unexpected 'stages'

六眼飞鱼酱① 提交于 2021-02-11 12:38:05
问题 I have gotten pretty close with my template and my deploy yaml that uses it. However I am getting to errors Unexpected value 'variables' Unexpected value 'stages' I am sure I have the syntax wrong, but I can't for the life of me understand why. Here is the start of my template #File: template.yml parameters: - name: repositoryName type: string default: '' variables: tag: '$(Build.BuildId)' buildVmImage: 'ubuntu-latest' deployPool: 'deploy-pool' stages: - stage: Build jobs: - job: Build pool: