首页 \ 问答 \ 黄瓜与内置测试?(Cucumber vs. built-in testing? [Rails])

黄瓜与内置测试?(Cucumber vs. built-in testing? [Rails])

我昨天问了一个关于不同测试框架的问题。 这个问题可以在这里找到。 现在我对不同的框架有了更好的理解,我有一个非常简单的问题:

有了基本的理解,但是使用内置的测试框架(基本断言)编写测试的经验非常有限,我可以直接跳到RSpec,Webrat和Cucumber测试中吗?

谢谢!


作为一个方面说明:是的,这是一个基于意见的问题,但我觉得这个问题的意见对于社区保持这个问题的公开性是足够宝贵的。 谢谢。


I asked a question about different testing frameworks yesterday. This question can be found here. Now that I have a better understanding of the different frameworks, I have a very simple question:

With a basic understanding, but very limited experience with writing tests with rails' built in testing framework (basic assertions), would it be okay for me to jump directly to testing with RSpec, Webrat, and Cucumber?

Thank you!


As a side note: yes, this is an opinion based question, but I feel that the input received to this question is valuable enough to the community to keep this question open. Thanks.


原文:https://stackoverflow.com/questions/2443855
更新时间:2021-07-05 22:07

最满意答案

当我问自己同样的问题时,“我可以使用配置器的输出来输入另一个资源的变量吗?”,我找到了答案。

在这个时候,提供者的结果只是简单地传输到terraform的标准中,而不会被捕获。

鉴于您在两个节点上运行远程供应商,并且您尝试访问S3中的值 - 我同意这种方法,我也会这样做 - 您可能需要做的是处理脚本中的竞争条件使用sleep命令,或通过调度脚本稍后使用atcron或类似的调度系统运行。

一般来说,Terraform想要预先访问所有变量,或者作为提供者的结果。 提供者不一定被视为Terraform中的头等舱。 我不在核心团队,所以我不能说为什么,但我的推测是,它会降低复杂性,忽略成功或失败以外的预设结果,因为提供者只是脚本,因此他们的结果通常是非结构化的。

如果您需要更多的增强功能来设置您的实例,我建议一个专门的工具来实现此目的,比如Ansible,Chef,Puppet等。Terraform的重点确实在于基础设施,而不是软件组件。


When I asked myself the same question, "Can I use output from a provisioner to feed into another resource's variables?", I went to the source for answers.

At this moment in time, provisioner results are simply streamed to terraform's standard out and never captured.

Given that you are running remote provisioners on both nodes, and you are trying to access values from S3 - I agree with this approach by the way, I would do the same - what you probably need to do is handle the race condition in your script with a sleep command, or by scheduling a script to run later with the at or cron or similar scheduling systems.

In general, Terraform wants to access all variables either up front, or as the result of a provider. Provisioners are not necessarily treated as first-class in Terraform. I'm not on the core team so I can't say why, but my speculation is that it reduces complexity to ignore provisioner results beyond success or failure, since provisioners are just scripts so their results are generally unstructured.

If you need more enhanced capabilities for setting up your instances, I suggest a dedicated tool for that purpose like Ansible, Chef, Puppet, etc. Terraform's focus is really on Infrastructure, rather than software components.

相关问答

更多
  • 解决方案是创建一个resource "null_resource" "nameYouWant" { }然后在其中运行您的命令。 它们将在创建初始资源后运行: resource "aws_instance" "consul" { count = 3 ami = "ami-ce5a9fa3" instance_type = "t2.micro" key_name = "ansible_aws" tags { Name = "consul" } } resource "null_ ...
  • 那应该是node["team"] 。 我们很久以前就弃用了方法语法,并在Chef 13中删除了它。 That should be node["team"]. We deprecated the method syntax long ago and it was removed in Chef 13.
  • 你应该使用user_data 。 用户数据字段是惯用的,因为它是AWS自带的,而远程执行代理程序特定于Terraform,这只是调用AWS API的多种方法之一。 另外,用户数据可在AWS控制台中查看,并且通常是在AWS中使用Auto Scaling组的重要部分,您希望每个EC2实例在启动时执行相同的配置代码。 Terraform的远程执行代理程序无法做到这一点。 You should use user_data. The user data field is idiomatic because it's ...
  • Terraform的数据源功能旨在获取不经常更改的数据,并且(通常)仅在代表操作员进行故意操作时才会更改。 遗憾的是,下一个“可用”CIDR块不是一个很好的候选者,因为创建下一个 VPC的行为会改变结果,导致结果配置永远不会收敛。 相反,Terraform希望明确地进行这种分配。 在这种情况下,这意味着为您的网络建立一个明确的编号约定,然后您可以在Terraform配置中对其进行描述,从而允许Terraform根据配置中已有的信息查找或计算合适的VPC。 例如,AWS用户通常定义一个映射,以便为每个区域和区 ...
  • 这是通过一些无关的bash清理解决的。 Terraform的格式是正确的,它按预期运行。 我们没有在bash脚本中正确处理传入的IP地址,因此它失败了。 在调试方面,Terraform并不是最强大的,所以追踪它有点棘手。 This was solved via some unrelated bash cleanup. The format for the Terraform is correct and it was operating as expected. We weren't dealing wit ...
  • 您需要将wait_for_fulfillment = true添加到您的spot实例请求,否则资源将在创建实例之前返回。 You need to add wait_for_fulfillment = true to your spot instance request or the resource will return before the instance is created.
  • 当我问自己同样的问题时,“我可以使用配置器的输出来输入另一个资源的变量吗?”,我找到了答案。 在这个时候,提供者的结果只是简单地传输到terraform的标准中,而不会被捕获。 鉴于您在两个节点上运行远程供应商,并且您尝试访问S3中的值 - 我同意这种方法,我也会这样做 - 您可能需要做的是处理脚本中的竞争条件使用sleep命令,或通过调度脚本稍后使用at或cron或类似的调度系统运行。 一般来说,Terraform想要预先访问所有变量,或者作为提供者的结果。 提供者不一定被视为Terraform中的头等舱 ...
  • Terraform要求您指定用于与private_key连接的私有SSH密钥您可以创建一个新变量,其中包含私钥的路径,以便与Terraform的文件插值功能一起使用: connection { type = "ssh" user = "root" agent = true private_key = "${file("${var.private_key_path}")}" } Terraform requires that you specify the private S ...
  • 除了身份验证信息之外,还需要告诉Terraform应该使用哪个IP地址进行连接,如下所示: connection { type = "ssh" host = "${self.public_ip_address}" private_key = "${file("my_key.pem")}" user = "ubuntu" timeout = "20s" } 对于某些资源,Terraform能够从资源属性中自动推断出一些连接细节,但目前Li ...
  • 就像你自己说的那样,没有称为ip的aws_eip资源。 如果你使用 aws_instance.example.public_ip 它应该完全正常 Like you said it yourself, there is no aws_eip resource called ip. If you use the aws_instance.example.public_ip it should work totally fine

相关文章

更多

最新问答

更多
  • 获取MVC 4使用的DisplayMode后缀(Get the DisplayMode Suffix being used by MVC 4)
  • 如何通过引用返回对象?(How is returning an object by reference possible?)
  • 矩阵如何存储在内存中?(How are matrices stored in memory?)
  • 每个请求的Java新会话?(Java New Session For Each Request?)
  • css:浮动div中重叠的标题h1(css: overlapping headlines h1 in floated divs)
  • 无论图像如何,Caffe预测同一类(Caffe predicts same class regardless of image)
  • xcode语法颜色编码解释?(xcode syntax color coding explained?)
  • 在Access 2010 Runtime中使用Office 2000校对工具(Use Office 2000 proofing tools in Access 2010 Runtime)
  • 从单独的Web主机将图像传输到服务器上(Getting images onto server from separate web host)
  • 从旧版本复制文件并保留它们(旧/新版本)(Copy a file from old revision and keep both of them (old / new revision))
  • 西安哪有PLC可控制编程的培训
  • 在Entity Framework中选择基类(Select base class in Entity Framework)
  • 在Android中出现错误“数据集和渲染器应该不为null,并且应该具有相同数量的系列”(Error “Dataset and renderer should be not null and should have the same number of series” in Android)
  • 电脑二级VF有什么用
  • Datamapper Ruby如何添加Hook方法(Datamapper Ruby How to add Hook Method)
  • 金华英语角.
  • 手机软件如何制作
  • 用于Android webview中图像保存的上下文菜单(Context Menu for Image Saving in an Android webview)
  • 注意:未定义的偏移量:PHP(Notice: Undefined offset: PHP)
  • 如何读R中的大数据集[复制](How to read large dataset in R [duplicate])
  • Unity 5 Heighmap与地形宽度/地形长度的分辨率关系?(Unity 5 Heighmap Resolution relationship to terrain width / terrain length?)
  • 如何通知PipedOutputStream线程写入最后一个字节的PipedInputStream线程?(How to notify PipedInputStream thread that PipedOutputStream thread has written last byte?)
  • python的访问器方法有哪些
  • DeviceNetworkInformation:哪个是哪个?(DeviceNetworkInformation: Which is which?)
  • 在Ruby中对组合进行排序(Sorting a combination in Ruby)
  • 网站开发的流程?
  • 使用Zend Framework 2中的JOIN sql检索数据(Retrieve data using JOIN sql in Zend Framework 2)
  • 条带格式类型格式模式编号无法正常工作(Stripes format type format pattern number not working properly)
  • 透明度错误IE11(Transparency bug IE11)
  • linux的基本操作命令。。。