Skip to content

Commit

Permalink
NAS-133753: Change default URI of docker registry when creating app r…
Browse files Browse the repository at this point in the history
…egistries (#11380)
  • Loading branch information
AlexKarpov98 authored Jan 24, 2025
1 parent 2784bb6 commit bc0fc26
Show file tree
Hide file tree
Showing 6 changed files with 184 additions and 183 deletions.
2 changes: 1 addition & 1 deletion src/app/interfaces/docker-registry.interface.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,4 +9,4 @@ export interface DockerRegistry {

export type DockerRegistryPayload = Omit<DockerRegistry, 'id'>;

export const dockerHubRegistry = 'https://registry-1.docker.io/';
export const dockerHubRegistry = 'https://index.docker.io/v1/';
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ import { MockComponent } from 'ng-mocks';
import { of } from 'rxjs';
import { mockCall, mockApi } from 'app/core/testing/utils/mock-api.utils';
import { mockAuth } from 'app/core/testing/utils/mock-auth.utils';
import { DockerRegistry } from 'app/interfaces/docker-registry.interface';
import { dockerHubRegistry, DockerRegistry } from 'app/interfaces/docker-registry.interface';
import { DialogService } from 'app/modules/dialog/dialog.service';
import { SearchInput1Component } from 'app/modules/forms/search-input1/search-input1.component';
import { IxIconHarness } from 'app/modules/ix-icon/ix-icon.harness';
Expand All @@ -27,7 +27,7 @@ describe('DockerRegistriesListComponent', () => {
id: 1,
name: 'Docker Hub',
description: 'Docker Hub',
uri: 'https://index.docker.io/v1/',
uri: dockerHubRegistry,
username: 'docker',
password: 'password',
},
Expand Down Expand Up @@ -65,7 +65,7 @@ describe('DockerRegistriesListComponent', () => {
it('should show table rows', async () => {
const expectedRows = [
['Name', 'Username', 'URI', ''],
['Docker Hub', 'docker', 'https://index.docker.io/v1/', ''],
['Docker Hub', 'docker', dockerHubRegistry, ''],
];

expect(spectator.inject(ApiService).call).toHaveBeenCalledWith('app.registry.query');
Expand All @@ -92,7 +92,7 @@ describe('DockerRegistriesListComponent', () => {

expect(spectator.inject(SlideIn).open).toHaveBeenCalledWith(DockerRegistryFormComponent, {
data: {
isLoggedInToDockerHub: false,
isLoggedInToDockerHub: true,
},
});
});
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ import {
} from '@ngneat/spectator/jest';
import { mockApi, mockCall } from 'app/core/testing/utils/mock-api.utils';
import { mockAuth } from 'app/core/testing/utils/mock-auth.utils';
import { dockerHubRegistry } from 'app/interfaces/docker-registry.interface';
import { DialogService } from 'app/modules/dialog/dialog.service';
import { IxSelectHarness } from 'app/modules/forms/ix-forms/components/ix-select/ix-select.harness';
import { FormErrorHandlerService } from 'app/modules/forms/ix-forms/services/form-error-handler.service';
Expand All @@ -22,7 +23,7 @@ describe('DockerRegistryFormComponent', () => {

const mockRegistry = {
id: 1,
uri: 'https://registry-1.docker.io/',
uri: dockerHubRegistry,
name: 'Old Registry',
username: 'old_user',
password: '',
Expand Down Expand Up @@ -76,7 +77,7 @@ describe('DockerRegistryFormComponent', () => {

expect(api.call).toHaveBeenCalledWith('app.registry.create', [
{
uri: 'https://registry-1.docker.io/',
uri: dockerHubRegistry,
name: 'Docker Hub',
username: 'admin',
password: 'password',
Expand Down Expand Up @@ -134,7 +135,7 @@ describe('DockerRegistryFormComponent', () => {
const values = await form.getValues();

expect(values).toEqual({
URI: 'https://registry-1.docker.io/',
URI: dockerHubRegistry,
Name: 'Old Registry',
Username: 'old_user',
Password: '',
Expand All @@ -147,7 +148,7 @@ describe('DockerRegistryFormComponent', () => {
it('sends an update payload and closes the modal when the save button is clicked', async () => {
const form = await loader.getHarness(IxFormHarness);
await form.fillForm({
URI: 'https://registry-1.docker.io/',
URI: dockerHubRegistry,
Name: 'Updated Registry',
Username: 'updated_user',
Password: 'updated_password',
Expand All @@ -159,7 +160,7 @@ describe('DockerRegistryFormComponent', () => {
expect(api.call).toHaveBeenCalledWith('app.registry.update', [
1,
{
uri: 'https://registry-1.docker.io/',
uri: dockerHubRegistry,
name: 'Updated Registry',
username: 'updated_user',
password: 'updated_password',
Expand Down
Loading

0 comments on commit bc0fc26

Please sign in to comment.