hst/instance: embed config struct
	
		
			
	
		
	
	
		
	
		
			All checks were successful
		
		
	
	
		
			
				
	
				Test / Create distribution (push) Successful in 34s
				
			
		
			
				
	
				Test / Sandbox (push) Successful in 41s
				
			
		
			
				
	
				Test / Sandbox (race detector) (push) Successful in 40s
				
			
		
			
				
	
				Test / Hakurei (push) Successful in 2m20s
				
			
		
			
				
	
				Test / Hakurei (race detector) (push) Successful in 2m59s
				
			
		
			
				
	
				Test / Hpkg (push) Successful in 3m20s
				
			
		
			
				
	
				Test / Flake checks (push) Successful in 1m28s
				
			
		
		
	
	
				
					
				
			
		
			All checks were successful
		
		
	
	Test / Create distribution (push) Successful in 34s
				
			Test / Sandbox (push) Successful in 41s
				
			Test / Sandbox (race detector) (push) Successful in 40s
				
			Test / Hakurei (push) Successful in 2m20s
				
			Test / Hakurei (race detector) (push) Successful in 2m59s
				
			Test / Hpkg (push) Successful in 3m20s
				
			Test / Flake checks (push) Successful in 1m28s
				
			This makes the resulting json easier to parse since it can now be deserialised into the config struct. Signed-off-by: Ophestra <cat@gensokyo.uk>
This commit is contained in:
		
							parent
							
								
									05488bfb8f
								
							
						
					
					
						commit
						2442eda8d9
					
				| @ -189,7 +189,6 @@ App | |||||||
|   "instance": "8e2c76b066dabe574cf073bdb46eb5c1", |   "instance": "8e2c76b066dabe574cf073bdb46eb5c1", | ||||||
|   "pid": 3405691582, |   "pid": 3405691582, | ||||||
|   "shim_pid": 3735928559, |   "shim_pid": 3735928559, | ||||||
|   "config": { |  | ||||||
|   "id": "org.chromium.Chromium", |   "id": "org.chromium.Chromium", | ||||||
|   "enablements": { |   "enablements": { | ||||||
|     "wayland": true, |     "wayland": true, | ||||||
| @ -336,7 +335,6 @@ App | |||||||
|     "device": true, |     "device": true, | ||||||
|     "share_runtime": true, |     "share_runtime": true, | ||||||
|     "share_tmpdir": true |     "share_tmpdir": true | ||||||
|     } |  | ||||||
|   }, |   }, | ||||||
|   "time": "1970-01-01T00:00:00.000000009Z" |   "time": "1970-01-01T00:00:00.000000009Z" | ||||||
| } | } | ||||||
| @ -537,7 +535,6 @@ func TestPrintPs(t *testing.T) { | |||||||
|     "instance": "8e2c76b066dabe574cf073bdb46eb5c1", |     "instance": "8e2c76b066dabe574cf073bdb46eb5c1", | ||||||
|     "pid": 3405691582, |     "pid": 3405691582, | ||||||
|     "shim_pid": 3735928559, |     "shim_pid": 3735928559, | ||||||
|     "config": { |  | ||||||
|     "id": "org.chromium.Chromium", |     "id": "org.chromium.Chromium", | ||||||
|     "enablements": { |     "enablements": { | ||||||
|       "wayland": true, |       "wayland": true, | ||||||
| @ -684,7 +681,6 @@ func TestPrintPs(t *testing.T) { | |||||||
|       "device": true, |       "device": true, | ||||||
|       "share_runtime": true, |       "share_runtime": true, | ||||||
|       "share_tmpdir": true |       "share_tmpdir": true | ||||||
|       } |  | ||||||
|     }, |     }, | ||||||
|     "time": "1970-01-01T00:00:00.000000009Z" |     "time": "1970-01-01T00:00:00.000000009Z" | ||||||
|   } |   } | ||||||
|  | |||||||
| @ -60,13 +60,11 @@ def check_state(name, enablements): | |||||||
|         raise Exception(f"unexpected state length {len(instances)}") |         raise Exception(f"unexpected state length {len(instances)}") | ||||||
|     instance = next(iter(instances.values())) |     instance = next(iter(instances.values())) | ||||||
| 
 | 
 | ||||||
|     config = instance['config'] |     if len(instance['container']['args']) != 1 or not (instance['container']['args'][0].startswith("/nix/store/")) or f"hakurei-{name}-" not in (instance['container']['args'][0]): | ||||||
|  |         raise Exception(f"unexpected args {instance['container']['args']}") | ||||||
| 
 | 
 | ||||||
|     if len(config['container']['args']) != 1 or not (config['container']['args'][0].startswith("/nix/store/")) or f"hakurei-{name}-" not in (config['container']['args'][0]): |     if instance['enablements'] != enablements: | ||||||
|         raise Exception(f"unexpected args {config['container']['args']}") |         raise Exception(f"unexpected enablements {instance['enablements']}") | ||||||
| 
 |  | ||||||
|     if config['enablements'] != enablements: |  | ||||||
|         raise Exception(f"unexpected enablements {config['enablements']}") |  | ||||||
| 
 | 
 | ||||||
| 
 | 
 | ||||||
| start_all() | start_all() | ||||||
|  | |||||||
| @ -80,7 +80,7 @@ type State struct { | |||||||
| 	ShimPID int `json:"shim_pid"` | 	ShimPID int `json:"shim_pid"` | ||||||
| 
 | 
 | ||||||
| 	// Configuration used to start the container. | 	// Configuration used to start the container. | ||||||
| 	Config *Config `json:"config"` | 	*Config | ||||||
| 
 | 
 | ||||||
| 	// Point in time the shim process was created. | 	// Point in time the shim process was created. | ||||||
| 	Time time.Time `json:"time"` | 	Time time.Time `json:"time"` | ||||||
|  | |||||||
							
								
								
									
										14
									
								
								test/test.py
									
									
									
									
									
								
							
							
						
						
									
										14
									
								
								test/test.py
									
									
									
									
									
								
							| @ -58,17 +58,15 @@ def check_state(name, enablements): | |||||||
|         raise Exception(f"unexpected state length {len(instances)}") |         raise Exception(f"unexpected state length {len(instances)}") | ||||||
|     instance = next(iter(instances.values())) |     instance = next(iter(instances.values())) | ||||||
| 
 | 
 | ||||||
|     config = instance['config'] |  | ||||||
| 
 |  | ||||||
|     command = f"{name}-start" |     command = f"{name}-start" | ||||||
|     if not (config['container']['path'].startswith("/nix/store/")) or not (config['container']['path'].endswith(command)): |     if not (instance['container']['path'].startswith("/nix/store/")) or not (instance['container']['path'].endswith(command)): | ||||||
|         raise Exception(f"unexpected path {config['path']}") |         raise Exception(f"unexpected path {instance['path']}") | ||||||
| 
 | 
 | ||||||
|     if len(config['container']['args']) != 1 or config['container']['args'][0] != command: |     if len(instance['container']['args']) != 1 or instance['container']['args'][0] != command: | ||||||
|         raise Exception(f"unexpected args {config['args']}") |         raise Exception(f"unexpected args {instance['args']}") | ||||||
| 
 | 
 | ||||||
|     if config['enablements'] != enablements: |     if instance['enablements'] != enablements: | ||||||
|         raise Exception(f"unexpected enablements {config['enablements']['enablements']}") |         raise Exception(f"unexpected enablements {instance['enablements']['enablements']}") | ||||||
| 
 | 
 | ||||||
| 
 | 
 | ||||||
| def hakurei(command): | def hakurei(command): | ||||||
|  | |||||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user