throttle: do not use invalid config in test
The (burst) max parameter cannot be smaller than the avg parameter. There is a test case that uses avg = 56, max = 1 and gets away with it because no input validation is performed by the test case. This patch switches to valid test input parameters. Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com> Reviewed-by: Alberto Garcia <berto@igalia.com> Message-id: 20170301115026.22621-3-stefanha@redhat.com Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
This commit is contained in:
		
							parent
							
								
									01f9cfab8b
								
							
						
					
					
						commit
						ab08aec45f
					
				@ -206,7 +206,7 @@ static void test_config_functions(void)
 | 
				
			|||||||
    orig_cfg.buckets[THROTTLE_OPS_WRITE].avg = 23;
 | 
					    orig_cfg.buckets[THROTTLE_OPS_WRITE].avg = 23;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    orig_cfg.buckets[THROTTLE_BPS_TOTAL].max = 0;  /* should be corrected */
 | 
					    orig_cfg.buckets[THROTTLE_BPS_TOTAL].max = 0;  /* should be corrected */
 | 
				
			||||||
    orig_cfg.buckets[THROTTLE_BPS_READ].max  = 1; /* should not be corrected */
 | 
					    orig_cfg.buckets[THROTTLE_BPS_READ].max  = 56; /* should not be corrected */
 | 
				
			||||||
    orig_cfg.buckets[THROTTLE_BPS_WRITE].max = 120;
 | 
					    orig_cfg.buckets[THROTTLE_BPS_WRITE].max = 120;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    orig_cfg.buckets[THROTTLE_OPS_TOTAL].max = 150;
 | 
					    orig_cfg.buckets[THROTTLE_OPS_TOTAL].max = 150;
 | 
				
			||||||
@ -247,7 +247,7 @@ static void test_config_functions(void)
 | 
				
			|||||||
    g_assert(final_cfg.buckets[THROTTLE_OPS_WRITE].avg == 23);
 | 
					    g_assert(final_cfg.buckets[THROTTLE_OPS_WRITE].avg == 23);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    g_assert(final_cfg.buckets[THROTTLE_BPS_TOTAL].max == 15.3); /* fixed */
 | 
					    g_assert(final_cfg.buckets[THROTTLE_BPS_TOTAL].max == 15.3); /* fixed */
 | 
				
			||||||
    g_assert(final_cfg.buckets[THROTTLE_BPS_READ].max  == 1);   /* not fixed */
 | 
					    g_assert(final_cfg.buckets[THROTTLE_BPS_READ].max  == 56);   /* not fixed */
 | 
				
			||||||
    g_assert(final_cfg.buckets[THROTTLE_BPS_WRITE].max == 120);
 | 
					    g_assert(final_cfg.buckets[THROTTLE_BPS_WRITE].max == 120);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    g_assert(final_cfg.buckets[THROTTLE_OPS_TOTAL].max == 150);
 | 
					    g_assert(final_cfg.buckets[THROTTLE_OPS_TOTAL].max == 150);
 | 
				
			||||||
 | 
				
			|||||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user