Skip to content

Commit

Permalink
Merge pull request #7236 from mook-as/win32/classic-networking/remove…
Browse files Browse the repository at this point in the history
…-pref

Win32: Remove UI for classic networking
  • Loading branch information
mook-as authored Jul 23, 2024
2 parents ef90b99 + b0aa155 commit dbb29ae
Show file tree
Hide file tree
Showing 14 changed files with 43 additions and 100 deletions.
6 changes: 0 additions & 6 deletions .github/workflows/bats.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -35,10 +35,6 @@ on:
description: Package run ID override; leave empty to use latest.
default: ''
type: string
rd-use-networking-tunnel:
description: Use networking tunnel (on Windows)
default: true
type: boolean
schedule:
- cron: '0 8 * * 1-5' # 8AM UTC weekdays as a baseline

Expand Down Expand Up @@ -246,7 +242,6 @@ jobs:
RD_USE_GHCR_IMAGES: "true"
RD_USE_RAMDISK: "true"
RD_USE_WINDOWS_EXE: "${{ runner.os == 'Windows' }}"
RD_USE_NETWORKING_TUNNEL: "${{ runner.os == 'Windows' && format('{0}', inputs.rd-use-networking-tunnel) != 'false' }}"
WSLENV: "\
GITHUB_TOKEN:\
RD_CAPTURE_LOGS:\
Expand All @@ -258,7 +253,6 @@ jobs:
RD_USE_GHCR_IMAGES:\
RD_USE_RAMDISK:\
RD_USE_WINDOWS_EXE:\
RD_USE_NETWORKING_TUNNEL:\
"
working-directory: bats
timeout-minutes: 120
Expand Down
3 changes: 0 additions & 3 deletions bats/tests/helpers/vm.bash
Original file line number Diff line number Diff line change
Expand Up @@ -186,9 +186,6 @@ start_container_engine() {
--experimental.virtual-machine.mount.9p.security-model="$RD_9P_SECURITY_MODEL"
)
fi
if is_windows; then
args+=("--experimental.virtual-machine.networking-tunnel=$(bool using_networking_tunnel)")
fi
if using_vz_emulation; then
args+=(--experimental.virtual-machine.type vz)
if is_macos aarch64; then
Expand Down
4 changes: 0 additions & 4 deletions e2e/pages/preferences/wsl.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,19 +3,15 @@ import type { Page, Locator } from '@playwright/test';
export class WslNav {
readonly page: Page;
readonly nav: Locator;
readonly networkingTunnel: Locator;
readonly wslIntegrations: Locator;
readonly addressTitle: Locator;
readonly tabIntegrations: Locator;
readonly tabNetwork: Locator;
readonly tabProxy: Locator;

constructor(page: Page) {
this.page = page;
this.nav = page.locator('[data-test="nav-wsl"]');
this.networkingTunnel = page.locator('[data-test="networkingTunnel"]');
this.tabIntegrations = page.locator('.tab >> text=Integrations');
this.tabNetwork = page.locator('.tab >> text=Network');
this.tabProxy = page.locator('.tab >> text=Proxy');
this.wslIntegrations = page.locator('[data-test="wslIntegrations"]');
this.addressTitle = page.locator('[data-test="addressTitle"]');
Expand Down
13 changes: 1 addition & 12 deletions e2e/preferences.e2e.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -199,25 +199,14 @@ test.describe.serial('Main App Test', () => {
await expect(kubernetes.kubernetesOptions).toBeVisible();
});

test('should navigate to WSL and render network tab', async() => {
test('should navigate to WSL and render integrations tab', async() => {
test.skip(os.platform() !== 'win32', 'WSL nav item not available on macOS & Linux');
const { wsl } = new PreferencesPage(preferencesWindow);

await wsl.nav.click();

await expect(wsl.nav).toHaveClass('preferences-nav-item active');

await expect(wsl.tabNetwork).toHaveText('Network');
await expect(wsl.tabIntegrations).toBeVisible();
await expect(wsl.tabIntegrations).toHaveText('Integrations');

await expect(wsl.networkingTunnel).toBeVisible();
});

test('should integrations tab', async() => {
test.skip(os.platform() !== 'win32', 'WSL nav item not available on macOS & Linux');
const { wsl } = new PreferencesPage(preferencesWindow);

await wsl.tabIntegrations.click();
await expect(wsl.wslIntegrations).toBeVisible();
});
Expand Down
1 change: 1 addition & 0 deletions pkg/rancher-desktop/assets/specs/command-api.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -696,6 +696,7 @@ components:
type: boolean
x-rd-platforms: [win32]
x-rd-usage: tunnel networking so it originates from the host
x-rd-hidden: true # Only available by editing settings file directly.
type:
type: string
enum: [qemu, vz]
Expand Down
8 changes: 1 addition & 7 deletions pkg/rancher-desktop/components/Preferences/BodyWsl.vue
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@ import Vue from 'vue';
import { mapGetters, mapState } from 'vuex';
import PreferencesWslIntegrations from '@pkg/components/Preferences/WslIntegrations.vue';
import PreferencesWslNetwork from '@pkg/components/Preferences/WslNetwork.vue';
import PreferencesWslProxy from '@pkg/components/Preferences/WslProxy.vue';
import RdTabbed from '@pkg/components/Tabbed/RdTabbed.vue';
import Tab from '@pkg/components/Tabbed/Tab.vue';
Expand All @@ -18,7 +17,7 @@ import type { PropType } from 'vue';
export default Vue.extend({
name: 'preferences-body-wsl',
components: {
RdTabbed, Tab, PreferencesWslIntegrations, PreferencesWslNetwork, PreferencesWslProxy,
RdTabbed, Tab, PreferencesWslIntegrations, PreferencesWslProxy,
},
props: {
preferences: {
Expand Down Expand Up @@ -61,11 +60,6 @@ export default Vue.extend({
@changed="tabSelected"
>
<template #tabs>
<tab
label="Network"
name="network"
:weight="3"
/>
<tab
label="Integrations"
name="integrations"
Expand Down
43 changes: 0 additions & 43 deletions pkg/rancher-desktop/components/Preferences/WslNetwork.vue

This file was deleted.

23 changes: 17 additions & 6 deletions pkg/rancher-desktop/config/__tests__/settings.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -347,10 +347,15 @@ describe('settings', () => {
.mockImplementation(createMocker(ProfileTypes.None, ProfileTypes.Unlocked));
const profiles = await readDeploymentProfiles();
const expectedDefaults = _.omit(fullDefaults, ['debug', 'ignorableTestSettings', 'diagnostics.locked']);
const expected = {
const expected: RecursivePartial<settings.Settings> = {
version: settings.CURRENT_SETTINGS_VERSION,
containerEngine: {
name: 'moby',
name: settings.ContainerEngine.MOBY,
},
experimental: {
virtualMachine: {
networkingTunnel: true,
},
},
kubernetes: {
version: '1.25.9',
Expand Down Expand Up @@ -467,7 +472,8 @@ describe('settings', () => {
version: settings.CURRENT_SETTINGS_VERSION,
experimental: {
virtualMachine: {
proxy: {
networkingTunnel: true,
proxy: {
noproxy: ['1.2.3.4', '11.12.13.14', '21.22.23.24'],
},
},
Expand Down Expand Up @@ -500,7 +506,8 @@ describe('settings', () => {
version: settings.CURRENT_SETTINGS_VERSION,
experimental: {
virtualMachine: {
proxy: {
networkingTunnel: true,
proxy: {
noproxy: ['1.2.3.4', '11.12.13.14', '21.22.23.24'],
},
},
Expand Down Expand Up @@ -535,7 +542,7 @@ describe('settings', () => {
};
const expected = _.merge({}, s, { version: settings.CURRENT_SETTINGS_VERSION });

expect(settingsImpl.migrateSpecifiedSettingsToCurrentVersion(s, false)).toEqual(expected);
expect(settingsImpl.migrateSpecifiedSettingsToCurrentVersion(s, false)).toMatchObject(expected);
});

it('updates all old settings going back to version 1', () => {
Expand Down Expand Up @@ -578,7 +585,11 @@ describe('settings', () => {
containerEngine: {
name: settings.ContainerEngine.MOBY,
},
experimental: {},
experimental: {
virtualMachine: {
networkingTunnel: true,
},
},
kubernetes: {},
virtualMachine: {
hostResolver: true,
Expand Down
2 changes: 1 addition & 1 deletion pkg/rancher-desktop/config/settings.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
import { PathManagementStrategy } from '@pkg/integrations/pathManager';
import { RecursivePartial } from '@pkg/utils/typeUtils';

export const CURRENT_SETTINGS_VERSION = 12 as const;
export const CURRENT_SETTINGS_VERSION = 13 as const;

export enum VMType {
QEMU = 'qemu',
Expand Down
4 changes: 4 additions & 0 deletions pkg/rancher-desktop/config/settingsImpl.ts
Original file line number Diff line number Diff line change
Expand Up @@ -481,6 +481,10 @@ export const updateTable: Record<number, (settings: any, locked : boolean) => vo
_.unset(settings, 'experimental.virtualMachine');
}
},
12: (settings) => {
// This bump is only there to force networking tunnel.
_.set(settings, 'experimental.virtualMachine.networkingTunnel', true);
},
};

function migrateSettingsToCurrentVersion(settings: Record<string, any>): Settings {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -78,6 +78,7 @@ describe(SettingsValidator, () => {
['experimental', 'virtualMachine', 'mount', '9p', 'protocolVersion'],
['experimental', 'virtualMachine', 'mount', '9p', 'securityModel'],
['experimental', 'virtualMachine', 'mount', 'type'],
['experimental', 'virtualMachine', 'networkingTunnel'], // Cannot be set
['experimental', 'virtualMachine', 'type'],
['experimental', 'virtualMachine', 'useRosetta'],
['experimental', 'virtualMachine', 'proxy', 'noproxy'],
Expand All @@ -88,17 +89,16 @@ describe(SettingsValidator, () => {

// Fields that can only be set on specific platforms.
const platformSpecificFields: Record<string, ReturnType<typeof os.platform>> = {
'application.adminAccess': 'linux',
'experimental.virtualMachine.networkingTunnel': 'win32',
'experimental.virtualMachine.proxy.enabled': 'win32',
'experimental.virtualMachine.proxy.address': 'win32',
'experimental.virtualMachine.proxy.password': 'win32',
'experimental.virtualMachine.proxy.port': 'win32',
'experimental.virtualMachine.proxy.username': 'win32',
'kubernetes.ingress.localhostOnly': 'win32',
'virtualMachine.hostResolver': 'win32',
'virtualMachine.memoryInGB': 'darwin',
'virtualMachine.numberCPUs': 'linux',
'application.adminAccess': 'linux',
'experimental.virtualMachine.proxy.enabled': 'win32',
'experimental.virtualMachine.proxy.address': 'win32',
'experimental.virtualMachine.proxy.password': 'win32',
'experimental.virtualMachine.proxy.port': 'win32',
'experimental.virtualMachine.proxy.username': 'win32',
'kubernetes.ingress.localhostOnly': 'win32',
'virtualMachine.hostResolver': 'win32',
'virtualMachine.memoryInGB': 'darwin',
'virtualMachine.numberCPUs': 'linux',
};

const spyValidateSettings = jest.spyOn(subject, 'validateSettings');
Expand Down
4 changes: 2 additions & 2 deletions pkg/rancher-desktop/main/commandServer/settingsValidator.ts
Original file line number Diff line number Diff line change
Expand Up @@ -128,8 +128,8 @@ export default class SettingsValidator {
// see https://github.com/rancher-sandbox/rancher-desktop/issues/6953
// The setting will be removed once the legacy Windows networking mode is disabled, so until
// then we will allow changing the setting on all platforms to avoid the profile error.
// Changing the setting will have no effect on macOS/Linux anyways.
networkingTunnel: this.checkBoolean,
// Changing the setting will have no effect on macOS/Linux anyways.1
networkingTunnel: this.checkUnchanged,
useRosetta: this.checkPlatform('darwin', this.checkRosetta),
type: this.checkPlatform('darwin', this.checkMulti(
this.checkEnum(...Object.values(VMType)),
Expand Down
6 changes: 3 additions & 3 deletions src/go/rdctl/pkg/plist/plist_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ func TestJsonToPlistFormat(t *testing.T) {
<plist version="1.0">
<dict>
<key>version</key>
<integer>12</integer>
<integer>13</integer>
</dict>
</plist>
`, s)
Expand All @@ -33,7 +33,7 @@ func TestJsonToPlistFormat(t *testing.T) {
<plist version="1.0">
<dict>
<key>version</key>
<integer>12</integer>
<integer>13</integer>
<key>application</key>
<dict>
<key>extensions</key>
Expand Down Expand Up @@ -369,7 +369,7 @@ func TestJsonToPlistFormat(t *testing.T) {
<plist version="1.0">
<dict>
<key>version</key>
<integer>12</integer>
<integer>13</integer>
<key>application</key>
<dict>
<key>extensions</key>
Expand Down
4 changes: 2 additions & 2 deletions src/go/rdctl/pkg/reg/reg_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ func TestJsonToRegFormat(t *testing.T) {
assert.Equal(t, "[HKEY_CURRENT_USER\\SOFTWARE\\Policies]", lines[1])
assert.Equal(t, "[HKEY_CURRENT_USER\\SOFTWARE\\Policies\\Rancher Desktop]", lines[2])
assert.Equal(t, "[HKEY_CURRENT_USER\\SOFTWARE\\Policies\\Rancher Desktop\\defaults]", lines[3])
assert.Equal(t, `"version"=dword:c`, lines[4])
assert.Equal(t, `"version"=dword:d`, lines[4])
})
t.Run("converts the registry-type arguments into reg headers", func(t *testing.T) {
type testCaseType struct {
Expand Down Expand Up @@ -112,7 +112,7 @@ func TestJsonToRegFormat(t *testing.T) {
assert.NoError(t, err)
assert.Equal(t, 12, len(lines))
assert.Equal(t, fmt.Sprintf("[%s]", header), lines[3])
assert.Equal(t, `"version"=dword:c`, lines[4])
assert.Equal(t, `"version"=dword:d`, lines[4])
assert.Equal(t, fmt.Sprintf("[%s\\application]", header), lines[5])
assert.Equal(t, fmt.Sprintf("[%s\\application\\extensions]", header), lines[6])
assert.Equal(t, fmt.Sprintf("[%s\\application\\extensions\\allowed]", header), lines[7])
Expand Down

0 comments on commit dbb29ae

Please sign in to comment.