Integration tests fixes & deleting copr ansible scripts

This commit is contained in:
gezimbll
2023-08-04 10:51:50 -04:00
committed by Dan Christian Bogos
parent 5bea63841b
commit a63b180f2a
7 changed files with 6 additions and 122 deletions

View File

@@ -193,6 +193,7 @@ func testPrecacheGetCacheStatsAfterRestart(t *testing.T) {
utils.CacheResources: {Items: 3},
utils.CacheReverseDestinations: {Items: 7},
utils.CacheRPCResponses: {},
utils.MetaSentryPeer: {},
utils.CacheSharedGroups: {Items: 1},
utils.CacheStatFilterIndexes: {
Items: 2,

View File

@@ -132,6 +132,7 @@ func loadConfig() (ldrCfg *config.CGRConfig) {
log.Fatalf("Error loading config file %s", err)
}
config.SetCgrConfig(ldrCfg)
dfltCfg = config.CgrConfig()
}
// Data for DataDB
if *dataDBType != dfltCfg.DataDbCfg().Type {

View File

@@ -1,3 +0,0 @@
{{ ansible_managed | comment }}
if $programname == '{{ service_name }}' then /var/log/{{ service_name }}/output.log
& stop

View File

@@ -1,16 +0,0 @@
{{ ansible_managed | comment }}
[Unit]
Description= Gateway between REST and Copr to add multiple branches support in Copr builds
ConditionPathExists={{ coprgate_dir }}
After=network.target
[Service]
Environment="V10={{ v10 }}" "MASTER={{ nightly }}"
ExecStart=/usr/local/bin/{{ service_name }}
Restart=on-failure
RestartSec=10
StandardOutput=journal
StandardError=journal
SyslogIdentifier={{ service_name }}
[Install]
WantedBy=multi-user.target

View File

@@ -1,99 +0,0 @@
- hosts: pkg
vars:
coprgate_dir: "/home/{{ user }}/go/src/github.com/cgrates/coprgate"
coprgate_bin: "/home/{{ user }}/go/bin/coprgate"
service_name: coprgate
tasks:
- name: Install dependencies
become: yes
apt:
name:
- git
- tar
state: present
- name: Install Go
import_role:
name: ../roles/go
- name: Create coprgate directory
become: yes
file:
state: directory
mode: 'u=rwx,go=rx'
owner: "{{ user }}"
group: "{{ user }}"
dest: '{{ coprgate_dir }}'
become_user: "{{ user }}"
- name: Clone coprgate from github repository
git:
repo: https://github.com/cgrates/coprgate.git
dest: '{{ coprgate_dir }}'
update: yes
force: yes
become: yes
- name: Install coprgate
shell: "go install coprgate.go"
environment:
PATH: "{{ lookup('env','PATH') }}:/home/{{ user }}/go/bin:/usr/local/go/bin:{{ ansible_env.PATH }}"
args:
chdir: '{{ coprgate_dir }}'
- name: Copy coprgate to system executable
become: yes
copy:
src: "{{ coprgate_bin }}"
remote_src: true
dest: "/usr/local/bin"
unsafe_writes: yes
- name: Changing the permissions
become: yes
file:
path: /usr/local/bin/{{ service_name }}
owner: root
mode: 0755
- name: Create the service file
become: yes
template:
src: coprgate.service.j2
dest: /etc/systemd/system/coprgate.service
- name: Reload daemon and start the service
become: yes
ansible.builtin.systemd:
state: started
daemon_reload: true
name: coprgate.service
enabled: true
- name: Create directory for reading logs
become: yes
file:
path: /var/log/{{ service_name }}
state: directory
- name: Change log file permissions
become: yes
file:
path: /var/log/{{ service_name }}
owner: '{{ user }}'
group: '{{ user }}'
state: directory
- name: Create the log file
become: yes
template:
src: coprgate.conf.j2
dest: /etc/rsyslog.d/coprgate.conf
- name: Restart rsyslog
become: yes
shell: "systemctl restart rsyslog.service"

View File

@@ -140,7 +140,7 @@ func testDspChcLoadAfterFolder(t *testing.T) {
expStats[utils.CacheRouteProfiles].Items = 3
expStats[utils.CacheThresholdProfiles].Items = 2
expStats[utils.CacheThresholds].Items = 2
expStats[utils.CacheLoadIDs].Items = 30
expStats[utils.CacheLoadIDs].Items = 31
expStats[utils.CacheTimings].Items = 10
expStats[utils.CacheThresholdFilterIndexes].Items = 2
expStats[utils.CacheThresholdFilterIndexes].Groups = 1
@@ -211,8 +211,8 @@ func testDspChcPrecacheStatus(t *testing.T) {
utils.CacheEventCharges: utils.MetaReady,
utils.CacheReverseFilterIndexes: utils.MetaReady,
utils.CacheCapsEvents: utils.MetaReady,
utils.MetaAPIBan: utils.MetaReady,
utils.MetaSentryPeer: utils.MetaReady,
utils.MetaAPIBan: utils.MetaReady,
utils.CacheReplicationHosts: utils.MetaReady,
}

View File

@@ -153,7 +153,7 @@ func testTutSMGCacheStats(t *testing.T) {
expectedStats[utils.CacheAttributeProfiles].Items = 2
expectedStats[utils.MetaDefault].Items = 1
expectedStats[utils.CacheActionTriggers].Items = 1
expectedStats[utils.CacheLoadIDs].Items = 30
expectedStats[utils.CacheLoadIDs].Items = 31
expectedStats[utils.CacheChargerProfiles].Items = 1
expectedStats[utils.CacheRPCConnections].Items = 2
expectedStats[utils.CacheTimings].Items = 14