Skip to content

Commit

Permalink
add env vars for logging to set catsrc and channel (openshift#1870)
Browse files Browse the repository at this point in the history
  • Loading branch information
QiaolingTang authored Mar 1, 2021
1 parent a04589e commit f8641cd
Show file tree
Hide file tree
Showing 3 changed files with 43 additions and 13 deletions.
32 changes: 20 additions & 12 deletions features/step_definitions/logging.rb
Original file line number Diff line number Diff line change
Expand Up @@ -326,26 +326,34 @@

Given /^logging channel name is stored in the#{OPT_SYM} clipboard$/ do | cb_name |
cb_name = 'logging_channel_name' unless cb_name
version = cluster_version('version').version.split('-')[0].split('.').take(2).join('.')
case version
when '4.1'
cb[cb_name] = "preview"
when '4.7'
cb[cb_name] = "5.0"
if env.logging_channel_name.empty?
version = cluster_version('version').version.split('-')[0].split('.').take(2).join('.')
case version
when '4.1'
cb[cb_name] = "preview"
when '4.7'
cb[cb_name] = "5.0"
else
cb[cb_name] = version
end
else
cb[cb_name] = version
cb[cb_name] = env.logging_channel_name
end
end

Given /^#{QUOTED} packagemanifest's catalog source name is stored in the#{OPT_SYM} clipboard$/ do |packagemanifest, cb_name|
cb_name = "catsrc_name" unless cb_name
project("openshift-marketplace")
if catalog_source("qe-app-registry").exists?
cb[cb_name] = "qe-app-registry"
if env.logging_catsrc.empty?
if catalog_source("qe-app-registry").exists?
cb[cb_name] = "qe-app-registry"
else
@result = admin.cli_exec(:get, resource: 'packagemanifest', resource_name: packagemanifest, n: 'openshift-marketplace', o: 'yaml')
raise "Unable to get catalog source name" unless @result[:success]
cb[cb_name] = @result[:parsed]['status']['catalogSource']
end
else
@result = admin.cli_exec(:get, resource: 'packagemanifest', resource_name: packagemanifest, n: 'openshift-marketplace', o: 'yaml')
raise "Unable to get catalog source name" unless @result[:success]
cb[cb_name] = @result[:parsed]['status']['catalogSource']
cb[cb_name] = env.logging_catsrc
end
end

Expand Down
2 changes: 1 addition & 1 deletion features/test/logging_metrics.feature
Original file line number Diff line number Diff line change
Expand Up @@ -11,4 +11,4 @@ Feature: test logging and metrics related steps
Given I obtain test data file "logging/clusterlogging/example.yaml"
Given I create clusterlogging instance with:
| crd_yaml | example.yaml |
| remove_logging_pods | true |
| remove_logging_pods | true |
22 changes: 22 additions & 0 deletions lib/environment.rb
Original file line number Diff line number Diff line change
Expand Up @@ -224,6 +224,28 @@ def authentication_url
return @authentication_url
end

def logging_channel_name
unless @logging_channel_name
if opts[:logging_channel_name]
@logging_channel_name = opts[:logging_channel_name]
else
@logging_channel_name = ''
end
end
return @logging_channel_name
end

def logging_catsrc
unless @logging_catsrc
if opts[:logging_catsrc]
@logging_catsrc = opts[:logging_catsrc]
else
@logging_catsrc = ''
end
end
return @logging_catsrc
end

# naming scheme is https://logs.<cluster_id>.openshift.com for Online
# for OCP it's https://logs.<subdomain>.openshift.com
def logging_console_url
Expand Down

0 comments on commit f8641cd

Please sign in to comment.