Serverspec站点的"高级提示"部分显示了使用相同测试集测试多个主机的示例.我已经建立了一个我自己的例子(https://gist.github.com/neilhwatson/81249ad393800a76a8ad),但是有问题.
第一个问题是测试在第一次失败时停止,而不是继续通过该批次并保持计数.第二个是故障输出并不表示故障发生在哪个主机上.我该怎么做才能解决这些问题并为所有主机生成最终报告?
此 CF 模板失败:
MyECSrepo:
Type: "AWS::ECR::Repository"
Properties:
RepositoryName: !Ref RepoName
RepositoryPolicyText:
Version: "2012-10-17"
Statement:
- Sid: AllowAll
Effect: Allow
Principal:
AWS:
- arn:aws:iam::00000000000:group/admin
Action:
- "ecr:*"
Run Code Online (Sandbox Code Playgroud)
堆栈创建产生此错误:
“PolicyText”中的无效参数未能满足约束:“提供的存储库策略无效”
可能是什么问题?
我已经构建了一些serverspec代码来在多个主机上运行一组测试.问题是当任何测试失败时,测试在当前主机上停止.即使测试失败,我希望它继续所有主机.
Rakefile:
namespace :spec do
task :all => hosts.map {|h| 'spec:' + h.split('.')[0] }
hosts.each do |host|
begin
desc "Run serverspec to #{host}"
RSpec::Core::RakeTask.new(host) do |t|
ENV['TARGET_HOST'] = host
t.pattern = "spec/cfengine3/*_spec.rb"
end
rescue
end
end
end
Run Code Online (Sandbox Code Playgroud)
完整代码:https: //gist.github.com/neilhwatson/1d41c696102c01bbb87a
我正在尝试使用jaydebeapi python lib连接到配置单元服务器,但出现错误。我没有JAVA经验。可能是什么问题,或者如何调试?
./beeline-jdbc.py
CLASSPATH is :/usr/hdp/2.4.3.0-227/hadoop/conf:/usr/hdp/2.4.3.0-227/hadoop/lib/*:/usr/hdp/2.4.3.0-227/hadoop/.//*:/usr/hdp/2.4.3.0-227/hadoop-hdfs/./:/usr/hdp/2.4.3.0-227/hadoop-hdfs/lib/*:/usr/hdp/2.4.3.0-227/hadoop-hdfs/.//*:/usr/hdp/2.4.3.0-227/hadoop-yarn/lib/*:/usr/hdp/2.4.3.0-227/hadoop-yarn/.//*:/usr/hdp/2.4.3.0-227/hadoop-mapreduce/lib/*:/usr/hdp/2.4.3.0-227/hadoop-mapreduce/.//*::mysql-connector-java-5.1.37:mysql-connector-java-5.1.37-bin.jar:mysql-connector-java-5.1.37.zip:mysql-connector-java.jar:/usr/hdp/2.4.3.0-227/tez/*:/usr/hdp/2.4.3.0-227/tez/lib/*:/usr/hdp/2.4.3.0-227/tez/conf:/usr/hdp/current/hadoop-client/*:/usr/hdp/current/hive-client/lib/*:/usr/hdp/current/hadoop-client/client/*
Traceback (most recent call last):
File "./beeline-jdbc.py", line 18, in <module>
, hivejar)
File "/home/dev/lib/JayDeBeApi-1.0.0-py2.6.egg/jaydebeapi/__init__.py", line 380, in connect
jconn = _jdbc_connect(jclassname, url, driver_args, jars, libs)
File "/home/dev/lib/JayDeBeApi-1.0.0-py2.6.egg/jaydebeapi/__init__.py", line 199, in _jdbc_connect_jpype
return jpype.java.sql.DriverManager.getConnection(url, *dargs)
RuntimeError: No matching overloads found. at native/common/jp_method.cpp:117
Run Code Online (Sandbox Code Playgroud)
一个脚本:
#!/usr/bin/env python
import jaydebeapi
import os
principal='hive/dev15-namenode-01.example.com@example.COM'
server='localhost'
port=10000
database='tsz'
hivejar='/usr/hdp/current/hive-client/lib/hive-jdbc.jar'
url=("jdbc:hive2://" + server + ":" + str(port) + "/default;principal="
+ principal + ";")
print 'CLASSPATH is '+os.environ['CLASSPATH']
c=jaydebeapi.connect("org.apache.hive.jdbc.HiveDriver", [ …Run Code Online (Sandbox Code Playgroud) 我从下面的代码部分得到了上述错误.原因是什么?
1 require 'spec_helper'
2
3 before(:all) do
4 puts "ServerSpec tests on #{ENV['TARGET_HOST']}"
5 end
Run Code Online (Sandbox Code Playgroud)
完整错误:
/home/newatson/src/serverspec/spec/cfengine3/common_spec.rb:3:in `<top (required)>': undefined method `before' for main:Object (NoMethodError)
from /home/newatson/.gem/ruby/1.9.1/gems/rspec-core-3.2.3/lib/rspec/core/configuration.rb:1226:in `load'
from /home/newatson/.gem/ruby/1.9.1/gems/rspec-core-3.2.3/lib/rspec/core/configuration.rb:1226:in `block in load_spec_files'
from /home/newatson/.gem/ruby/1.9.1/gems/rspec-core-3.2.3/lib/rspec/core/configuration.rb:1224:in `each'
from /home/newatson/.gem/ruby/1.9.1/gems/rspec-core-3.2.3/lib/rspec/core/configuration.rb:1224:in `load_spec_files'
from /home/newatson/.gem/ruby/1.9.1/gems/rspec-core-3.2.3/lib/rspec/core/runner.rb:97:in `setup'
from /home/newatson/.gem/ruby/1.9.1/gems/rspec-core-3.2.3/lib/rspec/core/runner.rb:85:in `run'
from /home/newatson/.gem/ruby/1.9.1/gems/rspec-core-3.2.3/lib/rspec/core/runner.rb:70:in `run'
from /home/newatson/.gem/ruby/1.9.1/gems/rspec-core-3.2.3/lib/rspec/core/runner.rb:38:in `invoke'
from /home/newatson/.gem/ruby/1.9.1/gems/rspec-core-3.2.3/exe/rspec:4:in `<top (required)>'
from /home/newatson/.gem/ruby/1.9.1/bin/rspec:19:in `load'
from /home/newatson/.gem/ruby/1.9.1/bin/rspec:19:in `<main>'
Run Code Online (Sandbox Code Playgroud) 我是ruby的新手并尝试复制这个在ruby中调用匿名子程序的perl:
#!/usr/bin/perl
use strict;
use warnings;
use feature 'say';
# Make a reference to a subroutine
my $codes = {
one => sub {
say "This is code block one";
say "And this is code block one's line two"
},
};
for my $next_code ( keys %{ $codes } ) {
# Execute anonymous subroutine
&{ $codes->{ $next_code } };
}
Run Code Online (Sandbox Code Playgroud)
我试过这个:
#!/usr/bin/ruby -w
codes = {
one: puts "This is code block one"
puts "And this is code block …Run Code Online (Sandbox Code Playgroud) 我有一个参数:
ClusterSubnets:
Description: Subnets where cluster will reside.
Typically private. Use mutiples, each in a different AZ for HA.
ConstraintDescription: comma separated list of valid Subnet IDs
Type: List<AWS::EC2::Subnet::Id>
Run Code Online (Sandbox Code Playgroud)
我正在尝试输出:
ClusterSubnets:
Description: Subnets used by cluster
Value: !Ref ClusterSubnets
Export:
Name: !Sub "${AWS::StackName}-ClusterSubnets"
Run Code Online (Sandbox Code Playgroud)
但是,我得到了以下错误:模板格式错误:每个Outputs成员的Value字段必须求值为字符串。
如何导出列表?
我已经安装了Pivotal的Ops Manager.当我试图指出波什对它的导演我得到:
$ bosh target 10.120.7.11
Target set to 'p-bosh'
Invalid SSL Cert. Use --ca-cert option when setting target to specify SSL certificate
Run Code Online (Sandbox Code Playgroud)
证书是由安装自动生成的.如何通过此错误?
我正在尝试将子网 ID 列表传递给 Cloud 编队模板,但出现错误。我做错了什么?
模板中的参数:
ClusterSubnets:
Description: Subnets, in the same VPC where cluster ec2 instances reside.
Typically private. Use mutiples, each in a different AZ for HA.
Type: "List<AWS::EC2::Subnet::Id>"
Run Code Online (Sandbox Code Playgroud)
来自 json 文件的参数片段:
{
"ParameterKey": "ClusterSubnets",
"ParameterValue": [ "subnet-8fc8c4f7" ]
},
Run Code Online (Sandbox Code Playgroud)
结果:参数验证失败:参数参数 [1].ParameterValue 的类型无效,值:[u'subnet-8fc8c4f7'],类型:类型“列表”,有效类型:类型“basestring”
这个容器在我的笔记本电脑上的 Docker 上运行良好,但在 Kubernetes 中运行时因 java.lang.OutOfMemoryError: Java heap space 崩溃。为什么?
apiVersion: extensions/v1beta1
kind: Deployment
metadata:
name: mem-eater
spec:
template:
metadata:
labels:
# Refer to this name when defining a service.
app: mem-eater
spec:
containers:
# This is the docker image on your docker registry. This one is on
# the official Docker registry.
- image: neilhwatson/memory-eater:prod
name: mem-eater
Run Code Online (Sandbox Code Playgroud)
它尝试设置资源限制和请求,以及 JVM Xmx 限制,但在所有情况下,崩溃都是完全相同的。
其他信息:
ruby ×4
serverspec ×3
rspec ×2
cf-bosh ×1
hadoop ×1
hive ×1
kubernetes ×1
perl ×1
python ×1
rspec3 ×1