Merge branch 'main_test_fixes' into development

* main_test_fixes:
  fixes in rclone module

# Conflicts:
#	test_basic.vsh
This commit is contained in:
2024-12-30 07:39:08 +01:00
5 changed files with 21 additions and 19 deletions

View File

@@ -2,8 +2,9 @@ module rclone
import freeflowuniverse.herolib.core.playbook
import freeflowuniverse.herolib.core.texttools
import os
const configfile = '${HOME}/.config/rclone/rclone.conf'
const configfile = '${os.home_dir()}/.config/rclone/rclone.conf'
// will look for personal configuration file in ~/hero/config .
// this file is in heroscript format and will have all required info to configure rclone
@@ -17,13 +18,15 @@ const configfile = '${HOME}/.config/rclone/rclone.conf'
// url:''
//```
pub fn configure() ! {
actions := playbook.new(
path: configfile
actor_filter: ['config']
action_filter: [
's3server_define',
]
mut plbook := playbook.new(
path: rclone.configfile
// actor_filter: ['config']
// action_filter: [
// 's3server_define',
// ]
)!
actions := plbook.find(filter: 'config.s3server_define')!
mut out := ''
for action in actions {
mut name := action.params.get_default('name', '')!

View File

@@ -1,7 +1,6 @@
module rclone
import os
import freeflowuniverse.herolib.core.texttools
// // RCloneClient represents a configured rclone instance
// pub struct RCloneClient {

View File

@@ -2,7 +2,6 @@ module rclone
import freeflowuniverse.herolib.core.base
import freeflowuniverse.herolib.core.playbook
import freeflowuniverse.herolib.ui.console
__global (
rclone_global map[string]&RCloneClient
@@ -91,9 +90,9 @@ pub fn play(args_ PlayArgs) ! {
if install_actions.len > 0 {
for install_action in install_actions {
mut p := install_action.params
mycfg := cfg_play(p)!
console.print_debug('install action rclone.configure\n${mycfg}')
set(mycfg)!
cfg_play(p)!
// console.print_debug('install action rclone.configure\n${mycfg}')
// set(mycfg)!
}
}
}

View File

@@ -34,7 +34,7 @@ pub fn heroscript_default() !string {
pub struct RCloneClient {
pub mut:
name string = 'default'
type_ string = 's3' // remote type (s3, sftp, etc)
type_ string = 's3' // remote type (s3, sftp, etc)
provider string = 'aws' // provider for s3 (aws, minio, etc)
access_key string // access key for authentication
secret_key string // secret key for authentication
@@ -44,13 +44,13 @@ pub mut:
fn cfg_play(p paramsparser.Params) ! {
mut mycfg := RCloneClient{
name: p.get_default('name', 'default')!
type_: p.get_default('type', 's3')!
provider: p.get_default('provider', 'aws')!
name: p.get_default('name', 'default')!
type_: p.get_default('type', 's3')!
provider: p.get_default('provider', 'aws')!
access_key: p.get('access_key')!
secret_key: p.get('secret_key')!
region: p.get_default('region', 'us-east-1')!
endpoint: p.get_default('endpoint', '')!
region: p.get_default('region', 'us-east-1')!
endpoint: p.get_default('endpoint', '')!
}
set(mycfg)!
}

View File

@@ -141,7 +141,7 @@ fn dotest(path string, base_dir string, mut cache TestCache) ! {
mut fp := flag.new_flag_parser(os.args)
fp.application('test_basic')
fp.description('Run tests for herolib')
remove_cache := fp.bool('r', `r`, false, 'Remove cache file before running tests', flag.FlagConfig{})
remove_cache := fp.bool('r', `r`, false, 'Remove cache file before running tests')
fp.finalize() or {
eprintln(err)
exit(1)
@@ -204,6 +204,7 @@ timetools_test.v
encoderhero/encoder_test.v
encoderhero/decoder_test.v
code/codeparser
gittools_test.v
'
// Split tests into array and remove empty lines