MCPcopy Create free account
hub / github.com/Qovery/engine / test_github_cr

Function test_github_cr

lib-engine/tests/container_registries/github_cr.rs:15–140  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

13#[named]
14#[test]
15fn test_github_cr() {
16 use qovery_engine::infrastructure::models::container_registry::RegistryTags;
17
18 let test_name = function_name!();
19 engine_run_test(|| {
20 let span = span!(Level::INFO, "test", name = test_name);
21 let _enter = span.enter();
22
23 let context = context_for_resource(generate_id(), generate_id());
24 let secrets = FuncTestsSecrets::new();
25 let registry_name = format!("test-{}", Uuid::new_v4());
26 let container_registry = GithubCr::new(
27 context.clone(),
28 Uuid::new_v4(),
29 registry_name.as_str(),
30 Url::parse("https://ghcr.io").unwrap(),
31 "qovery".to_string(),
32 secrets.GITHUB_ACCESS_TOKEN.unwrap(),
33 )
34 .unwrap();
35
36 let img_name = Uuid::new_v4();
37 let repo_name = container_registry
38 .registry_info()
39 .get_repository_name(img_name.to_string().as_str());
40 let repo_creation = container_registry.create_repository(
41 Some(registry_name.as_str()),
42 repo_name.as_str(),
43 0,
44 RegistryTags {
45 cluster_id: None,
46 environment_id: Some(Uuid::new_v4().to_string()),
47 project_id: Some(Uuid::new_v4().to_string()),
48 resource_ttl: None,
49 },
50 );
51 assert!(repo_creation.is_ok());
52
53 // given
54 let source_img = ContainerImage::new(
55 Url::parse("https://public.ecr.aws/").unwrap(),
56 "r3m4q3r9/qovery-ci".to_string(),
57 vec!["pause-3.10".to_string()],
58 );
59 let dest_img = ContainerImage::new(
60 container_registry.registry_info().get_registry_endpoint(None),
61 container_registry
62 .registry_info()
63 .get_image_name(img_name.to_string().as_str()),
64 vec!["test".to_string()],
65 );
66 context
67 .docker
68 .mirror(
69 &source_img,
70 &dest_img,
71 &mut |line| println!("[docker mirror stdout] {line}"),
72 &mut |line| eprintln!("[docker mirror stderr] {line}"),

Callers

nothing calls this directly

Calls 13

engine_run_testFunction · 0.85
context_for_resourceFunction · 0.85
get_repository_nameMethod · 0.80
get_image_nameMethod · 0.80
mirrorMethod · 0.80
generate_idFunction · 0.50
cloneMethod · 0.45
as_strMethod · 0.45
registry_infoMethod · 0.45
create_repositoryMethod · 0.45
get_registry_endpointMethod · 0.45
delete_imageMethod · 0.45

Tested by

no test coverage detected